Commit 0903ba9c by ichuang

fix optioninput to preserve author's ordering of options

parent 49ee1296
......@@ -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,
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment