selected value in Django forms.ChoiceField
Here i have the form
vote = forms.ChoiceField(widget=forms.Select(), choices=(('1', '1',), ('2',开发者_Go百科 '2',), ('3', '3',)), initial='2')
Django1.3 create from it the code
<option value="1">1</option>
<option value="2" selected="selected">2</option>
<option value="3">3</option>
This selected-tag does not work. Should be
<option value="2" selected>2</option>
What am I doing wrong?
Occasionally, I've seen browsers not select the appropriate option, even with selected="selected" when doing an F5 or Command + R (on Mac). However, doing a full refresh of the page (Ctrl + F5) in FF on Windows, or reloading the url from the address bar, will correctly select the selected option. FireFox does sometimes behave this way: http://www.beyondcoding.com/2008/12/16/option-selectedselected-not-working/
精彩评论