Is there a way to have a checkbox field pre-checked?
Also the markup for checkboxes in the form seems to vary. The “Send me a copy” has the <input> within the <label> whereas a field checkbox has them separate.
Hmm ok, so if you don’t enter anything in the “Value” field then it is checked by default… I guess my question should be amended to “how do you control whether a checkbox is checked or not” as it seems a bit trial-and-error.
Ok, I believe this logic is handled by Salesforce (Setup > Customize > Leads > Fields > Edit the field that is a checkbox > Default value) so I am marking this as resolved.
“Send me a copy” is output separately from the form HTML.
A checkbox should always have a value defined (or why bother having it?). The value is only sent if the user checks the checkbox, otherwise an empty string is sent.
Ok, that solves my other issue of the checkbox not sending data but if I add a value to it in WordPress-to-Lead it ignores the pre-checked condition set in Salesforce for that field.
It is a “I would like to receive correspondence” checkbox and should be checked by default.
p.s. sorry for two support posts, initially I thought they were two separate issues.
Pre-checked checkboxes (aka default value) aren’t supported in the plugin, yet. Checkboxes are fairly new and came from a fork, so I hadn’t given them much attention beyond merging in the changes.
Pre-checked checkboxes are generally to be avoided as they require the user to opt-out vs. opt-in, but I can see how the feature could be useful in some cases. I’ve added it to the next release feature list.
Just a note: the reason this hasn’t been implemented yet is it requires some updates to the admin UI to add another “default” field for checkboxes.
So it’ll happen, but probably not until 2.3.
Hey Nick, thanks for following up so awesomely!
What is very strange then is I am seeing my checkbox checked by default if I don’t specify a value in the plugin – so it seems to be reading the settings partially from Salesforce. As soon as I add a value (so data is actually sent!) the checkbox is unchecked by default.
Yeah, if you don’t enter a value, nothing gets sent for that field, and SalesForce’s default takes effect.
If you do enter a value, the plugin sends data (null or the value) which seems to cause SF not to use the default value set in its end.
I’m not sure if changing then plugin to not send anything if the checkbox is not checked would work at this point as it may break other sites that depend on the current behavior.
I am having a problem with checkboxes. They are all appearing on the form as checked. I have entered a label, but do not have a value in the value field. Shouldn’t these been unchecked?
Checkboxes have to have a value, even if all it is is 1.
No value means… nothing which matches nothing, which is why they are checked. No value means it won’t transfer to Salesforce either.
I’m a little confused. I put a value of 1 in all the checkbox fields, but they are still all checked on the form.
40lk_c “Enabled” Checkbox (field type) 401k (label) 1 (value)
What am I doing wrong?
Additionally, the form is no longer submitting. I cleared cache in browser too.
Can you posts screenshot of your form settings and a link to a form I can look at?
Here is the link to the form.
Not sure how I attach a file here. Don’t see an option. Am I missing it?
Those checkboxes do not have a value set – so you’re either entering that in the wrong field… or have discovered a new bug.
<input type="checkbox" id="sf_X401k__c" class="w2linput checkbox" name="X401k__c" value="" checked="checked">
value=”” = no value set…
But I can’t know for sure until I see your settings page so I can try to duplicate the issue.
You can’t attach files — you need to upload it to a photo sharing service (like http://tinypic.com) and include the link.
- The topic ‘Pre-checked checkbox’ is closed to new replies.