Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
I'm using CGI for a simple shopping cart script and I'm running in to some unexpected behaviour from the single checkbox function.
Given the following snippet of code:
$query->td({-colspan => 2, -width => '100%', -bgcolor => 'blue'}, $query->font({-color => 'white', -size => '-1', -face => 'arial, he +lvetica'}, $query->b('Shipping Information')). $query->font({-color => 'white', -size => '-2', -face => 'arial, he +lvetica'},' (Check to use Billing Information:)'). $query->checkbox(-name => 'copy', -value => 'off', -OnClick => 'jav +ascript:ShipToBillPerson(this.form);') )
which outputs this in the html genereation
<td bgcolor="blue" width="100%" colspan="2"> <font face="arial, helvetica" color="white" size="-1"> <b>Shipping Information</b> </font> <font face="arial, helvetica" color="white" size="-2"> (Check to use Billing Information:) </font> <input type="checkbox" name="copy" value="" onclick="javascript:Ale +rt('Checked!');" /> copy </td>
My question is, why the text "copy" is being inserted. I thought that naming the checkbox element was for referencing it through the param function? If I eliminate the -name part, I won't be able to see if it was checked will I? Also since "copy" is showing up in my text, what have I missed to eliminate "copy" as text on the page?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI.pm checkbox question
by ikegami (Patriarch) on Apr 29, 2005 at 16:45 UTC | |
|
Re: CGI.pm checkbox question
by jhourcle (Prior) on Apr 29, 2005 at 16:46 UTC | |
|
Re: CGI.pm checkbox question
by Popcorn Dave (Abbot) on Apr 30, 2005 at 01:39 UTC |