srins has asked for the wisdom of the Perl Monks concerning the following question:
I have checked if gui=>E,it is text box and if gui=>"R",it is drop down ie option menu.my @add=( { gui=>'E', value=>'Default ATS Location', name =>'res_op_file_loc', label=>'Result Output File ', default =>'Default ATS Location' }, { 'gui' => 'R', 'value' => 'ON', 'enum' => [ 'ON', ' OFF' ], 'name' => 'email_notif', 'label' => 'E-mail notification', 'default' => 'ON' } );
how to modify my code using template toolkit, by setting default option for option menu from default variable from hash.Can any body help me in this regard. Thanks, srins.<table> [% FOREACH element = add %] [% IF element.gui == "E" %] <tr> <td width="218" height="16"><font face="Times New Roman">[% elemen +t.label %] </font></td> <td width="713" height="16"> <font face="Times New Roman"> <input type="text" name="[%element.name %]" value="[%element.default +%]" size=" 58"> </td> </tr> [% ELSIF element.gui == "R" %] <tr> <td width="218" height="22"> <font color="#FF0000" face="Times New Roman">[% element.label %]</ +font></td> <td width="713" height="22"><font face="Times New Roman"> <select name="[% element.name %]" style="color: #FF0000" clas +s="sideeff ectcolor" id="sideeffectcolor">"> [% FOREACH option = element.enum %] <option value="[% option %]"> [% option %] </option> [% END %] </select>* </font></td> </tr> [% END %] [% END %] </table>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to define selected option in select option menu in template toolkit from hash
by davidrw (Prior) on Nov 09, 2005 at 23:40 UTC |