Watching the traffic going by on this issue, it seems that many of us set
defaults in pull down menus, radio button groups, and check boxes using
criteria from a user profile or a data base query.
Would it be possible to have HTML::Template add a checked or selected
element by allowing us to pass an optional parameter in TMPL_VAR? The
problem is HTML's inherent use of the un-paired parameters like CHECKED,
SELECTED, MULTIPLE. (Are there any others?).
Are CHECKED and SELECTED irritants for other users? (Or am I alone here?)
Today, for example, to create a check box
<TMPL_IF BOX_CHECKED>
<input type="checkbox" name="<tmpl_var name=NAME>" value="1" checked>
<TMPL_ELSE>
<input type="checkbox" name="<tmpl_var name=NAME>" value="1">
</TMPL_IF>
What about something like this?
<input type="checkbox" name=<tmpl_var name=NAME> value=<tmpl_var test=check
name=VALUE>
# Just an example. Is there a betterway to do this?
my $box = { NAME => '1', VALUE => {
var_val => 'option 1',
test => '1' }
};
$template->param ( BOX => $box );
resulting HTML
<input type="checkbox" name=1 value='option 1' checked>
-------------------
Similarly in Loops and Radio Buttons:
<select name="main_menu>
<TMPL_LOOP NAME=MAIN_MENU>
<option value=<tmpl_var escape=html name=VALUE test=select>><tmpl_var
escape=html name=NAME></option>
</TMPL_LOOP>
</select>
This would clean the template of conditionals that are inherent with HTML's
inputs and selects.
EM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]