Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Marking "checkbox" html field checked

by Danny (Hermit)
on Sep 18, 2024 at 18:53 UTC ( [id://11161830]=note: print w/replies, xml ) Need Help??


in reply to Marking "checkbox" html field checked

I prefer to keep such things as simple as possible unless there is a significant performance advantage. I'd prefer something like:
my $checked = $fieldValues{fieldName} ? 'checked="checked"' : ''; print qq{<input type="checkbox" name="fieldName" value="1" $checked/>\ +n};
or possibly
printf qq{<input type="checkbox" name="fieldName" value="1" %s/>\n}, $ +fieldValues{fieldName} ? 'checked="checked"' : '';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11161830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-10-08 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (44 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.