I have a simple form with a couple of select options. To illustrate it:
<form action="" method=GET>
<select name="sort">
<option value="name">name
<option value="age">age
<option value="gender">gender
<option value="location">location
</select>
<input type="submit" value="sort">
</form>
Say that the user uses the form, selects gender and hits the submit button.
I sort the records based on user input ( in Django by the way ) and then I render the same page, but sorted as the user wanted.
My question: can I, somehow, keep in the form the selected value gender and not name, which is the first one?
Pass the current sort field back to the template, then mark that option as
selected
as per the option docs: https://developer.mozilla.org/en/HTML/Element/optionThis would all be easier if you used the django forms framework.