use warnings; use strict; use CGI; my $cgi = CGI->new(); print "CGI.pm Version: $CGI::VERSION\n"; print $cgi->checkbox( { -name => 'cb-1', -value => 1, -label => "", -c +hecked => 'checked' } ); print "\n\n"; __END__ CGI.pm Version: 4.60 <label><input type="checkbox" name="cb-1" value="1" checked="checked" +/></label>
So I don't know what you're doing wrong, but it should work.
Aside: I don't know whether you've read the documentation in the last few years, but CGI.pm makes it pretty clear that its HTML Generation functions should no longer be used, and explains the reasons. (That note has been there since 4.04 released in September 2014.) As it explains, though it's recommended to use a full framework when possible, it is still reasonable to use CGI.pm for handling the input parameters and otherwise handling the Common Gateway Interface requests and responses (though CGI::Fast or others give the same hooks in a smaller package), but you should definitely use a templating toolkit of some sort for actually generating your HTML.
In reply to Re: is there anything more VEXING than checking the $cgi->checkbox ?
by pryrt
in thread is there anything more VEXING than checking the $cgi->checkbox ?
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |