Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2008, 09:58 PM
Junior Member
 
Join Date: May 2008
Posts: 3
Default Zend_Form Custom Validator message problem

Hi,

Was working on custom validation messages for a form I am working up and ran into a little snag.

My custom 'isEmpty' message works perfectly. My custom email address messages fall apart.

Entering in 'ff@ff' throws the following:

Code:
This does not appear to be a valid email address  (GOOD My custom Message)
'ff' does not match the expected structure for a DNS hostname -(Default)
'ff' appears to be a local network name but local network names are not allowed -(Default)
Ideally what I would like is for it to just throw the first custom message and skip the others but the way my code is I expected the first message all 3 times:

PHP Code:
        $email = new Zend_Form_Element_Text('email');
        
$email->setLabel('Your Email Address:')
              ->
addFilter('StringToLower')
              ->
setRequired(true)
              ->
addValidator('NotEmpty'true,  array(
                  
'messages' => array(
                      
'isEmpty' => 'Required - Please fill in your Email Address')))
              ->
addValidator('EmailAddress'true, array(
                     
'messages' => array(
                         
'emailAddressInvalid' => 'This does not appear to be a valid email address',
                        
'emailAddressInvalidHostname' => 'This does not appear to be a valid email address',
                        
'emailAddressInvalidMxRecord' => 'This does not appear to be a valid email address',
                        
'emailAddressDotAtom' => 'This does not appear to be a valid email address',
                        
'emailAddressQuotedString' => 'This does not appear to be a valid email address',
                        
'emailAddressInvalidLocalPart' => 'This does not appear to be a valid email address',
              ))); 
Any thoughts on what I might be doing wrong? How to fix? How to get it to spit out just the one error message?

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:29 PM.