[Templates] creating dynamic hidden fields in templates
Brian Clarkson
bclarkso@cisco.com
Tue, 05 Mar 2002 19:59:40 -0600
i've been fighting with this problem all day now, read through the
mailing list archives, but still haven't found a working solution.
i have one line in my template to create hidden fields:
[% cgi.hidden( Name => 'section' ).join %]
which will work if there are multiple values for the param name
'section'. the above code fails to generate a hidden form element if
there is only one value associated with the name ( and somewhat
understandably ... it IS a one-element array, but i remember reading
somewhere in the message archives that one-element arrays getr
downgraded to scalars ... )
so i tried this:
[% hidden_name = [ cgi.param( Name => 'section' ).list ] %]
[% IF hidden_name.size <= 1 %]
[% cgi.hidden( Name => 'section' ) %]
[% ELSIF hidden_name.size >= 2 %]
[% cgi.hidden( Name => 'section' ).join %]
[% ELSE %]
tests failed completely
[% END %]
but to no avail. the size of what should be @hidden_name always
evalutes to 1, never to more than one, even though there is also output
on the page ( rows in a table ) that correspond to the 'section' param
in the CGI object ...
am i missing something obvious?
brian