in reply to How do I select an option according to a specified value in HTML::Template::Pro?
HTML::Template and its derivative HTML::Template::Pro don't support the kind of conditionals you need for that, just simple bools. So what you need to write is
<select name="province_id" id="province"> <option value="-1">--</option> <TMPL_LOOP NAME="provinceloop"> <option value="<TMPL_VAR NAME="id">" <TMPL_IF is_selected>selected="true"</TMPL_IF>> + <TMPL_VAR NAME="name"></option> </TMPL_LOOP> </select>
And in the the perl code populate is_selected with a true value for the option where id eq current_key.
|
|---|