I've been trying to get multiple select forms working on my input_form template for ages. Just when I thought I had them beat I find another problem.
First I found that "ENUM" fields would not work with multiple select forms, and got things working using type "VARCHAR" or "TEXT". All seems well...
Next, I find the the multiple select form is not showing values on the modify.html template. Changing to "contains" instead of "eq" in the comparison displays selections on the modify page properly using the code below...
<select id="features" name="features" multiple="multiple" size=5>
<option value="None" <%if features contains 'None'%>selected<%endif%>>------None------</option>
<option value="Option1" <%if features contains 'Option1'%>selected<%endif%>>Option1</option>
<option value="Option2" <%if features contains 'Option2'%>selected<%endif%>>Option2</option>
<option value="Option3" <%if features contains 'Option3'%>selected<%endif%>>Option3</option>
</select>
The problem is, if there is an error made by users when adding or modifying a link the selections on the multiselect forms are lost. All except for the the values to the right, or rather the last one selected.
From the docs: "contains will be true if the variable contains the right-hand side."
Why would the code work on a the modify template, but not after an error???
Is there a way to fix this, or do I need give up and get started changing over to checkboxes???
Thanks
First I found that "ENUM" fields would not work with multiple select forms, and got things working using type "VARCHAR" or "TEXT". All seems well...
Next, I find the the multiple select form is not showing values on the modify.html template. Changing to "contains" instead of "eq" in the comparison displays selections on the modify page properly using the code below...
<select id="features" name="features" multiple="multiple" size=5>
<option value="None" <%if features contains 'None'%>selected<%endif%>>------None------</option>
<option value="Option1" <%if features contains 'Option1'%>selected<%endif%>>Option1</option>
<option value="Option2" <%if features contains 'Option2'%>selected<%endif%>>Option2</option>
<option value="Option3" <%if features contains 'Option3'%>selected<%endif%>>Option3</option>
</select>
The problem is, if there is an error made by users when adding or modifying a link the selections on the multiselect forms are lost. All except for the the values to the right, or rather the last one selected.
From the docs: "contains will be true if the variable contains the right-hand side."
Why would the code work on a the modify template, but not after an error???
Is there a way to fix this, or do I need give up and get started changing over to checkboxes???
Thanks