Optional field in message/contact form
This is an open discussion with 7 replies, filed under General.
Search
I presume you're saving the email into a Text Input field in your section. If so, go to Blueprints > Sections and un-tick the "required" checkbox against this field. Does that change anything?
Hi Nick, thanks for the reply.
Sorry, should've said - yep it's going to a text input which isn't a required field.
I still haven't managed to solve this, any help would be really appreciated - it's probably something fairly simple
send-email[sender-email]
is optional so the form shouldn't fail if it's omitted.
For clarity I presume you have:
- removed the
required="required"
from the HTML - ensured that the Email text field isn't required in the Symphony section
Can you change the form action
to ?debug
so you can see the save-message
event output on submit. What do you see?
Hi Nick, yep can confirm both of those things, and here's the output:
<save-message result="error"> <filter name="akismet" status="failed">Author and Email field mappings are required.</filter> <post-values> <from>John</from> <body>Testing again</body> </post-values> <message>Entry encountered errors when saving.</message> </save-message>
filter name="akismet"...
Oh, this is the Akismet plugin then. Akismet require that you submit both an author name and an email address for it to check spam. Check the documentation in your event (Blueprints > Events) to see how to set the Akismet field mappings. They work in the same way as the Send Notification Email (send-email[field]
) mappings.
It seems that if you want to use the Akismet filter on your event, you will have to make Email a required field.
Ah that did the trick. I'll give it a trial without Akismet for a while and see how it goes.
Thanks :)
Create an account or sign in to comment.
I did a search for this seemingly basic problem but couldn't find any answers. I have a contact form up & running (and working) on my test site, but I want to make the Email address field optional. I've pasted my code below but I've specifically tried to edit this bit below, to no avail:
I've tried changing required="required" to various other parameters as well as removing it completely but the emails either won't send or still require an email address when clicking submit.
The form:
Any help very appreciated