Hi everybody,

I have a question on the ifequal template tag.

I have an HTML select where people can filter the database entries. On
change of the selection I reload the page (new URL) and filter the
results. I append the selected value from the option to the request
(as berufe_id) and want to pre-select the chosen option with the
following code:

<select name="berufe" id="berufe" onchange="onSubmitFilterForm();">
                                <option value="0">-- Please select --</option>
                                {% for item in berufe %}
                                        <option value="{{item.id}}" {% ifequal 
item.id berufe_id %}
selected{% endifequal %}>{{item.name}}</option>
                                {% endfor %}
                        </select>

Somehow the equal check does not work. item.id is the id of the Object
iterator and berufe_id the selected value from the last selection...
{% ifequal item.id "2" %}selected{% endifequal %} seems to work
though...

Who can help me with this?

Thanks
Wolle

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to