I was under the impression that validators were only to be used to validate that submitted data was within domain boundaries instead of validating against a database or other data-store. To that end, I added some new events to my FormAction which further processed the submitted data against the database. However, since some of this processing is similar to a validator, this seems like the wrong place for such information.
For instance, in a form a user enters an email address (which is the unique log-in name in the database) and indicates that they are a new user. The user does not enter a password, so this is valid data and passes the validator. Next the flow proceeds to an action-state which calls the FormAction. Inside this state, we check the database to see if there is already a user that has the email address entered previously. If so, we return an error and tell the user that the email address already exists, and help them to recover their password.
To me, this is barely different than a validator, but does more than validate superficially.
Should I be placing this code inside my validator, or is there a better overall method for performing these actions? Having to manually call the form and error array out of the context seems a little redundant for something I assume is fairly common.