Is there any way to show appropriate errors using DynaValidator? I have a form with 3 fields, one for the username and two fields for a password. When you enter no values, a global error must be shown to the user. When the user enters an invalid character for the username, a messages that states that the user entered an invalid character should be shown in the web browser. When he enters a username that is already taken, the browser should show that. That also counts for the two password fields. A message should be displayed when they are unequal or that they don't correspond to the rules (at least one number and special sign).
I created my Validator-class, but I really don't know how to accomplish the situation above. Right now I'm drowning in a logic:messagesPresent and notPresent construction and if I have some sympathy for those who need to make some changes to this code, I'd have to replace it with a more clear and more understandable construction. Adding the whole validation-flow to one field is a solution, but I don't think that's a good one. You stuff everything in 1 method and that's that. Is there any other way to do this? I have validation on 2 methods, username and password. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.