fix optioninput to preserve author's ordering of options

This commit is contained in:
ichuang
2012-07-19 11:15:14 -04:00
parent 49ee12963f
commit 0903ba9c1f
2 changed files with 3 additions and 2 deletions

View File

@@ -132,7 +132,8 @@ def optioninput(element, value, status, render_template, msg=''):
oset = [x[1:-1] for x in list(oset)]
# osetdict = dict([('option_%s_%s' % (eid,x),oset[x]) for x in range(len(oset)) ]) # make dict with IDs
osetdict = dict([(oset[x],oset[x]) for x in range(len(oset)) ]) # make dict with key,value same
osetdict = [(oset[x],oset[x]) for x in range(len(oset)) ] # make ordered list with (key,value) same
# TODO: allow ordering to be randomized
context={'id':eid,
'value':value,

View File

@@ -2,7 +2,7 @@
<select name="input_${id}" id="input_${id}" >
<option value="option_${id}_dummy_default"> </option>
% for option_id, option_description in options.items():
% for option_id, option_description in options:
<option value="${option_id}"
% if (option_id==value):
selected="true"