Forum
Setting checkbox to checked in Form App
Hi,
I have added the Mailchimp app to my contact form to give users the option to join mailinglist. I have this working well but the problem I have is setting the checkbox to checked on page load. I can't see what I am doing wrong, I saw on perch_content there is default field but it wasn't mentioned in the form docs.
I have this for the input field, form example
<perch:input type="checkbox" id="confirm" label="mailinglist" checked="checked" value="1" mailer="confirm_subscribe" />
Try
Just got a chance to try it:
I have this in the form html template
It writes out this, the checkbox isn't selected
I am running the latest version of perch and the mailchimp app.
Ok, I'll look into it.
Great thanks. If I need to update part of the core to fix it I don't mind getting editing the files I need to.
Hi Drew,
I noticed there was a form app update. Did you managed to fix this issue in there?
It's not a Forms app issue. The Forms app is one way of processing a submitted form. It doesn't have anything to do with the display of forms.
Ok, I thought perch:input was related to the form app as that is where the issue seems to be.
No,
perch:input
is a template tag for creating a form input.The Forms app is a specific tool for collecting form responses and emailing or storing the result. The Forms app doesn't display forms - it's for processing some types of form submission.
Thanks for the clarification on what is what.
Going back to your last reply is there a solution to the issue with setting the default to checked?
No, but it is logged.
thanks
The
<perch:input>
checkboxes on my forms default tochecked
and I do not know how to default them to be unchecked. (I've tried variations on all the methods listed in this thread.) Is this a related issue to what's written here? Do you have any suggestions?Jason, if you have a problem you need to start a new thread including your template code.
Was this bug fixed in 2.7.4 update?
I don't think it's changed in 2.7.4. I'm not yet fully convinced that it's a bug, but it's logged to look into.