Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Marking "checkbox" html field checked

by stevieb (Canon)
on Sep 19, 2024 at 04:44 UTC ( [id://11161841]=note: print w/replies, xml ) Need Help??


in reply to Marking "checkbox" html field checked

Is there a common way or best practice, for creating a HTML "checkbox" form field

Yes. Use a templating system.

and marking it checked?

Yes. Use the templating system to pass the variable along, or use JavaScript/jQuery.

With that said, please, for the love of all things good, make sure this isn't an attempt to sucker someone into something that they then have to opt-out of. Any field that subscribes or commits someone to something should ALWAYS be unchecked by default. In such situations, default enabled is unscrupulous at best, and outright immoral and unethical (and more) at worst.

  • Comment on Re: Marking "checkbox" html field checked

Replies are listed 'Best First'.
Re^2: Marking "checkbox" html field checked
by Anonymous Monk on Sep 19, 2024 at 06:18 UTC
    should ALWAYS be unchecked by default

    ok... but we have no idea what this checkbox is for. Maybe it's to opt-in? Maybe it's to opt-out? Maybe it's to select which flavors of gummie the user wants?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2026-01-17 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (121 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.