Skip to main content

Default a checkbox to off?

How are the different checkboxes set to on or off by default?

 

I'd like to leave this as an option, but have it off by default:

 

<td><label for="signup_mobile_opt_in">{% check_box "mobile_opt_in", class:"checkbox" %} Send me text message updates</label></td>

 

In other places, the {% checkbox %} setting is off, but with as near as I can tell, identical code in the template. 

What am I missing? 

Official response from

We define whether a checkbox is checked or not based on best practices, but it's easy to change by editing the template of the page. In this case, you would remove:

{% check_box "mobile_opt_in", class:"checkbox" %}

And replace it with:

<input class="checkbox" id="signup_mobile_opt_in" name="signup[mobile_opt_in]" type="checkbox" value="1" checked />


Update: I have updated this code to add the term "checked" to the end of the <input> element to reflect updated web standards.

Share this post

Showing 11 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.