Gix075 / ajax-contact-form

An easy to use and hightly customizable Ajax Contact Form, including inputs validation and Google ReCaptcha.
MIT License
6 stars 1 forks source link

filetransfer field is required - make it optional #4

Closed MaCXyLo closed 7 years ago

MaCXyLo commented 7 years ago

Heyyo, thank you for your nice formular. :)

i tested it and have one question: the filetransfer field is required, but not every user want to send a file while he sends a message. it's a better idea to make it "optional" so the user can make a choice if he want to send a file or not. Is there any setting available for this case?

Kind Regards,

Gix075 commented 7 years ago

Hi @MaCXyLo on ajaxContactForm only name, email and message fields are strictly mandatory, and you can't remove them from the form (because the server script rejects the message if that fields are empty). All the rest of fields can be removed or you can set them as not required. For make the attachments field as not required you can simply remove the "validate" class from the following hidden input. This rule is valid for all fields that you want to make not required.

<input type="hidden" class="validate" name="acf_attachments" id="acf_attachments">

I hope that can help you! Let me know if this solution works, otherwise i will fix it!

MaCXyLo commented 7 years ago

Hey, i removed the validate class from acf_attachments acf-demo.html in line 84. works like a charm. thanks for that.

kind regards,