-
- 275 Posts
Hi,
How do I retain the value of a dropdown select (html <select>... <option> ...</select>) with Formit?
Right now it looses its selected value after the form check fails.
Thanks.
MODx Revolution / MAMP / OS X
-
- 275 Posts
Hi,
Thanks for the reply.
I implemented:
<select name='title' id='title' value='[[+title]]'>
<option value='' [[+fi.title:is=``:then=`selected="selected"`]]></option>
<option value='Miss' [[+fi.title:is=`Miss`:then=`selected="selected"`]]>Miss</option>
<option value='Mr.' [[+fi.title:is=`Mr.`:then=`selected="selected"`]]>Mr.</option>
<option value='Mrs.' [[+fi.title:is=`Mrs.`:then=`selected="selected"`]]>Mrs.</option>
<option value='Ms.' [[+fi.title:is=`Ms.`:then=`selected="selected"`]]>Ms.</option>
</select>
I added closing ` in then-clause.
I doesn’t seem to work.
Any clue what’s wrong??
Thanks for your help!
MODx Revolution / MAMP / OS X
-
- 659 Posts
Hello
Probably my fault, in the "select" the value must be "[[+fi.title]]" not "[[+title]]", in my example it should be
<select id="mySelect" name="mySelect" value="[[+fi.mySselect]]">
<option id="opt1" name="opt1" value="opt1" [[+fi.mySelect:is=`opt1`:then=`selected="selected"]]>OPT 1</option>
<option id="opt2" name="opt2" value="opt2" [[+fi.mySelect:is=`opt2`:then=`selected="selected"]]>OPT 2</option>
</select>
And then it should work... Sorry for this error in my example
Cheers
-
- 275 Posts
Yes, got it!
Great stuff, thanks again!
Cheers
MODx Revolution / MAMP / OS X