Closed jbroadway closed 8 years ago
If we make one addition to the form validation syntax, we can easily allow multiple validation error messages per field without requiring custom validations in PHP (which would also allow them to work client-side too). Here's an example:
[email] not empty = 1 ; failed[] = email [email:email-invalid] email = 1 ; failed[] = email-invalid
This would correspond to the following template code:
<p> <label>{"Email address"}</label><br /> <input type="email" name="email" value="{{email}}" /> <span class="notice" id="email-notice">{"Please enter an email address."}</span> <span class="notice" id="email-invalid-notice">{"Please enter a valid email address."}</span> </p>
Nothing else ought to need changing in the Form API for this to work.
Very appreciated feature!
If we make one addition to the form validation syntax, we can easily allow multiple validation error messages per field without requiring custom validations in PHP (which would also allow them to work client-side too). Here's an example:
This would correspond to the following template code:
Nothing else ought to need changing in the Form API for this to work.