You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2001/03/25 19:22:08 UTC
Problem with automatically checking checkboxes in $row loops?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
<form>
<table>
<tr>
<td>[+ $set[$row]{name} +]</td>
<td><input name=foo value='Y'></td>
</tr>
</table>
</form>
If I submit this form, $fdat{foo} will contain a tab-separated string
of 'Y' and '' values.
However when I do this, all the input fields will have a 'checked' in
them. I suspect it's keying off the first value in $fdat{foo}. It
ought to index the tab-separated string by the $row value. I tried
to work around this:
<input name=foo value='Y' [+ 'checked' if (...) +]>
but that just ended up with two 'checked' values in some places.
I finally did this:
[- $fdat{foo} = ... -]
<input name=foo value='Y'>
and thus fooled it into putting the right value there.
(I do wish that $fdat{foo} were a reference to an array--but that's a
separate issue)
- --
Kee Hinckley - Somewhere.Com, LLC - Cyberspace Architects
Now Playing - Folk, Rock, odd stuff - http://www.somewhere.com/playlist.cgi
I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOr5ePSZsPfdw+r2CEQJkXwCg9K9wSQjKVswCfn2mzzC+FnwOcvAAoJeO
RdKzuhpVQMCT9KYShVf57jWi
=jcD6
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Problem with automatically checking checkboxes in $row loops?
Posted by Gerald Richter <ri...@ecos.de>.
>
> <form>
> <table>
> <tr>
> <td>[+ $set[$row]{name} +]</td>
> <td><input name=foo value='Y'></td>
> </tr>
> </table>
> </form>
>
> If I submit this form, $fdat{foo} will contain a tab-separated string
> of 'Y' and '' values.
> However when I do this, all the input fields will have a 'checked' in
> them.
It doesn't look for the first value, but for the value attribute. So the
following code works correctly:
<td><input name=foo value='Y[+ $row +]'></td>
now you get Y1, Y2 etc.
>
> (I do wish that $fdat{foo} were a reference to an array--but that's a
> separate issue)
Maybe that had been a good idea, but for historical it isn't, but you can
easily convert it:
@a = split (/\t/, $fdat{foo}) ;
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org