I have a <select>
field in my Django form and what I'd like to do is set an <option>
to selected
depending on if the item has a certain value. The value is being passed as a GET
variable and contains an id of a page. How can I make it if value == <GET variable>: set option tag to selected
?
Asked
Active
Viewed 2,342 times
-1

Xeen
- 6,955
- 16
- 60
- 111
-
Any reason why my solution to [your existing question](http://stackoverflow.com/questions/19399339/how-to-set-a-predefined-form-value-from-a-link-in-django) on this subject was not suitable? If it wasn't, you should reply with a comment there explaining why. – Daniel Roseman Oct 16 '13 at 13:07
1 Answers
2
If its a form, then passing regular initial dictionary to form will suffice :

Community
- 1
- 1

Odif Yltsaeb
- 5,575
- 12
- 49
- 80