You are not logged in.
I want to add multiple validation rules and their associated error messages while creating a Zend Form element. Also want to list the error messages for all erroneous fields at the top of the form. How this can be achieved?
If I add some fields at run-time (e.g. qualification-1, 2 ... etc.) Is it possible to handle them and add suitable filters?
The other part is, if I want a client side validation using Zend jQuery support, is there any solve for inline and submit time validations? How to attach an AJAX related validation?
Last edited by samik (2010-08-07 21:51:59)
Offline
Hi Samik,
I think you're looking to user $form->getMessages() or $form->getErrorMessages() if you want to get the errors appearing on the top of your page.
adding fields dynamically is a little trickier, but is do-able if you use the zend_form methods to addElement() dynamically.
Hope that helps,
-
Jon
Offline
Thank you sir, for your suggestion. I shall try to elaborate my desire.
A single field may have multiple validation rules. For example a text field for taking user-name may have the following validations.
1. Required
2. must be alpha-numeric
3. single word
4. greater than 6 characters
so each validation should have different messages like
1. Please enter user-name
2. User-name must be alpha-numeric
3. It must be a single word
4. Please provide at least 6 characters.
So according to the actual invalid situation the message should be displayed. Not all at a time. or not only one for all errors. I am not able to script this situation.
Please help me out this thing.
Offline