1
$errors = array();

if ($form instanceof Form) {

    foreach ($form->getErrors(true, true) as $error) {
         $errors[] = $error->getMessage();
    }
}

I'm using AJAX request with my registration form. The JSON response now is like: ["error1", "error2", "error3"] . Code above works for me but I would like to get fields names aswell. I've tried few solutions but any of them works for me.

3
  • have you already see this? stackoverflow.com/questions/34066421/… Commented Dec 9, 2015 at 11:55
  • Thanks, that works for me perfectly. Commented Dec 9, 2015 at 21:44
  • hi @nix9 you are welcome! happy to know that help someone! Commented Dec 10, 2015 at 7:25

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.