I'm creating a form with drop down boxes like this:
SELECT(*options, _name='q%d' % (q_num), requires=IS_IN_SET(['1', '2', '3',
'4', '5'], error_message="Oops, looks like you missed this one.")
When options looks like this:
options = ['0', '1', '2', '3', '4', '5']
everything is fine. In particular, if there is a form validation error, the
form remembers which options was selected for each item.
However, if options looks like this:
options = [OPTION('', _value='0'),
OPTION('Never have the thought', _value='1'),
OPTION('Rarely have the thought ', _value='2'),
OPTION('Sometimes have the thought', _value='3'),
OPTION('Often have the thought', _value='4'),
OPTION('Always have the thought', _value='5')]
The form initially displays correctly, but when there is a validation
error, it forgets which option was previously selected. In particular, it
always says selected="0".
Is this a bug, or am I doing something wrong? Is there a workaround?
Neil