> Hello folks:
>
> Thanks for all the responses. Let me explain why I cannot
> populate the hash
> containing radiobutton/checkbox logic in Perl.
> My Perl script is written as a controller script which takes 'action' and
> 'data' as parameters. The action can be any of 'view', 'edit', 'update'
> etc. The data is just a literal indicating the datasource (does
> not need to
> match the actual table). The controller.pl combines the two
> literals, and
> looks for 2 files as a combo of <action><data>.tmpl, and .sql.
> The .tmpl is
> the template, and the .sql is the sql. As a result, the core controller
> script is not aware of any data fields at design time, and
> becomes database
> aware AT RUNTIME ONLY. This has allowed me to go against ANY table. The
> only caveat is that the fields retrieved by the SQL must match the
> fieldnames in the tmpl files. Of course there is some special processing
> logic in the controller script for inserts/updates, as they do not output
> views.
>
> Now do you see why I can't write the logic within Perl? I have to enable
> this within the .TMPL, no matter how bad it sounds in principle.
>
I have used javascript on a number of projects where I absolutely *had* to
separate the logic and the code. The JavaScript function was called 'onload'
and set all the values that were a bit more tricky than simple text (select
boxes, list boxes, radio/check button, etc.) It looks something like this:
main.tmpl
==============
<html>
<head>
<script>
function setvalues() [
var list=document.forms['mainform'].elements['STATE'];
for (i=0;i<list.options.length;i++)
if (list.options[i].value == "<tmpl_var name=STATE>")
list.options[i].selected = true;
}
</script>
</head>
<body onload="setvalues();">
<form name="mainform" ...>
<select name="STATE">
...
<option value="CA">CA</option>
...
</select>
</form>
</body>
</html>
I hope this helps.
Roy
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]