misterperl has asked for the wisdom of the Perl Monks concerning the following question:
$cgi->checkbox( { -name => 'cb-1', -value => 1, -label => "", -checked + => 'checked' } );
And the result is the same as when I leave out the -checked part: the html does NOT say checked. I inspected the actual HTML and its inexplicably missing. I added a debug point to print the HTML right after the checkbox ; its decidedly not there. The most vexing part- earlier today it worked. I've run the usual gauntlet of trying "checked", 1, "on" etc , recommended by various Perl sites; none cooperate today.
So being the end of the day Friday, I hate to be defeated, but I just added:
$cb = $cgi->checkbox( { -name => 'cb-1', -value => 1, -label => "" } ) +; $cb =~ s/(value)/checked $1/;
Which is really undesirable, and FUGLY, since the preference is to let the Perl CGI do the work. But unlike the CGI, THIS WORKS!
I'll review this Monday for suggestions but note to whoever wrote the Perl CGI- checkbox is a HOT MESS! Everytime I write code that has to check a checkbox it's like i DREAD it! Pretty much everything else in the CGI works as stated, but since this setting is stated like 6 different ways, maybe its not amazing it seldom works.
This was so frustrating that Monday I plan to look at the actual checkbox code IN the Perl CGI, but I just know it'll be like a switch with 3 globs, 2 closures, and 3 evals!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: is there anything more VEXING than checking the $cgi->checkbox ?
by pryrt (Abbot) on Nov 17, 2023 at 21:57 UTC | |
by misterperl (Friar) on Nov 20, 2023 at 14:38 UTC | |
by pryrt (Abbot) on Nov 20, 2023 at 15:30 UTC | |
|
Re: is there anything more VEXING than checking the $cgi->checkbox ?
by misterperl (Friar) on Nov 20, 2023 at 15:02 UTC | |
by haj (Vicar) on Nov 20, 2023 at 15:33 UTC | |
by pryrt (Abbot) on Nov 20, 2023 at 15:49 UTC | |
by cavac (Prior) on Nov 20, 2023 at 15:30 UTC |