Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Can forms plugin process differently depending on a condition?

Solved by hughbris View solution

Started by paul 7 years ago · 2 replies · 840 views
7 years ago

I have a simple contact form. I want to add a checkbox to enable someone to optionally subscribe to an email list when they submit the contact form.

Is there a way I can look for whether the checkbox has been checked, and have an additional form action if it has been?

Thanks in advance!

7 years ago Solution

If you are comfortable with PHP, you can create a custom form action.

There is also at least one mailing list plugin that might do this without a custom action, for Mailchimp I think. Search the plugins.

👍 1
7 years ago

Thanks for your reply! I found grav-plugin-mailchimp, which is not in the GPM, but works well. I don't need any extra logic, either, if I just use required_fields:, and reference the checkbox, in the mailchimp form-processing portion. That way, if the checkbox is checked, the mailchimp plugin action is called, and if not, it isn't.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago