0

I have a basic comment form with name, email and comment. Comments can be submitted by guests.

If a guest leaves all fields blank and submit the form, EE only throws one error, which is “the comment field is required” Then if the guest fills in the comment field and submit, EE throws the other two errors together, which are: “the name field is required” “the email field is required”

I need to read via ajax all 3 errors listed together, is there a way to do that? Any idea? Thanks for your help!

1
  • You could use AJAX to submit the form and return the results / errors, however this will not effect the behaviour of the form as you have described above. It will simply return the results asynchronously (without page refresh). I believe to validate the form in the way you desire you would require frontend JS - jQuery.
    – Edd Aslin
    May 14, 2014 at 22:57

1 Answer 1

0

I'd suggest doing front-end validation with a javascript library like Parsley or jQuery Validate - that way you don't have to rely on EE's errors at all.

1
  • Hi Derek, thanks for your suggestion. I decided to avoid client-side validation for some reason related to my website and do just a server side validation, that is why I need to deal with EE's errors list. May 14, 2014 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.