I can think of one way to do this using the ViewScript decorator, but it's
not very convenient. I am trying to get my head around the Zend_Form
component and customizing it to suit my needs. I'm currently working on an
example using the ViewScript decorator, but it's ugly. All of the markup
goes into the view, and controller, form model, and form view are all
tightly coupled.

I'm starting to think this component is more hassle than its worth, but
maybe I'm just a little slow on the uptake....

However, in my case, in the view script, on the email field:


<?php
   $errors = $form->email->getMessages();
   if (count($errors)):

?>
   <div class="formError">
      Email is invalid.
   </div><!--formError-->
<?php endif;?>

It's ugly and not very useful. Might as well roll your own forms using the
validate/filter components as do this on every form...but i'm sure there's
an easier way and some of the smart people will point it out.

Chinaski



dowker wrote:
> 
> When trying to validate an email address, many different validation
> messages can appear depending on what the user enters. For example, if a
> user enters "[EMAIL PROTECTED]" (without the quotes), we get the following
> validation messages:
> 
>     * 'test.' is not a valid hostname for email address '[EMAIL PROTECTED]'
>     * 'test.' appears to be a DNS hostname but cannot extract TLD part
>     * 'test.' does not appear to be a valid local network name
>     * 'test.' appears to be a local network name but local network names
> are not allowed
> 
> While this amount of detail can be very useful in some cases, it really
> isn't when trying to display user-friendly messages in a form.
> 
> Is there a way to limit the messages to something simple like "The email
> address you entered is incorrect."?
> 
> Thanks.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form-validation-messages-tp16467524p16467953.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to