<p>I agree it's unexpected behavior, but for Craft 2 it won't change.</p>

<p><a href="https://craftcms.com/3" rel="nofollow noreferrer">Craft 3</a> had a major overhaul of its event system and validation workflow where it works as you'd expect, though.</p>

CC BY-SA 3.0
2017-03-16T20:40:17.337Z
Boo! Oh well, at least I can stop wasting my time trying to figure out how to make it work how I want. I guess I'll have to upgrade to craft 3 once its production ready.
Rick Kukiela
CC BY-SA 3.0
2017-04-09T12:15:39.947Z
Thats a big ouch!
What about via ajax? Can we get to append errors this way? e.g. http://craftcms.stackexchange.com/questions/19707/ajax-front-end-user-registration-form-not-displaying-macro-errorlist
joomkit
CC BY-SA 3.0
2017-04-09T12:59:48.240Z
Just checked this out in ajax as per: http://craftcms.stackexchange.com/questions/19707/ajax-front-end-user-registration-form-not-displaying-macro-errorlist 
This looks promising
joomkit
CC BY-SA 3.0
2017-03-16T18:55:04.560Z
2017-03-16T18:55:04.560Z
Brad Bell
<p>I have additional fields I check for in the <code>onBeforeSaveUser</code> event and add the errors to the errors array. The problem is my code doesnt even run if they miss the main fields or if the email is already in use or something like that... I would like to return ALL validation errors, not just the default field errors first.</p>

<p>If I go to my form and just press submit without filling anything it out it only complains about the username, email address and password. If I just fill those fields out, then it comes back and complains about all my other fields (a la my event handler). This is unexpected behavior. Am I doing something wrong or is there a way to address this?</p>

<form><validation>
onBeforeSaveUser event does not fire if basic user fields do not validate
# onBeforeSaveUser event does not fire if basic user fields do not validate

(Asked by: username_0 on 2017-03-16)

I have additional fields I check for in the `onBeforeSaveUser` event and add the errors to the errors array. The problem is my code doesnt even run if they miss the main fields or if the email is already in use or something like that... I would like to return ALL validation errors, not just the default field errors first.

If I go to my form and just press submit without filling anything it out it only complains about the username, email address and password. If I just fill those fields out, then it comes back and complains about all my other fields (a la my event handler). This is unexpected behavior. Am I doing something wrong or is there a way to address this?

**Tags:** form, validation

---

## 1 answers

### Answer by username_1 on 2017-03-16. Score: 1 | Accepted answer

I agree it's unexpected behavior, but for Craft 2 it won't change.

[Craft 3](https://craftcms.com/3) had a major overhaul of its event system and validation workflow where it works as you'd expect, though.

> **Comments:**
> **username_0**: Boo! Oh well, at least I can stop wasting my time trying to figure out how to make it work how I want. I guess I'll have to upgrade to craft 3 once its production ready.  
> **username_2**: Thats a big ouch! What about via ajax? Can we get to append errors this way? e.g. http://craftcms.stackexchange.com/questions/19707/ajax-front-end-user-registration-form-not-displaying-macro-errorlist  
> **username_2**: Just checked this out in ajax as per: http://craftcms.stackexchange.com/questions/19707/ajax-front-end-user-registration-form-not-displaying-macro-errorlist  This looks promising  

---

