Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Can forms plugin process differently depending on a condition?

Solved by Hugh Barnes View solution

Started by paul 6 years ago · 2 replies · 578 views
6 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!

6 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
6 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 Ton Haarmans, 5 years ago
13 1140 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 63 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 138 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 114 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 132 7 months ago