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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-15-2007, 04:54 PM
Junior Member
 
Join Date: Aug 2007
Posts: 2
Default Zend_Validate_Alnum bug?

I tried to validate my input and translate the validation messages to Portuguese, but the AlNum filter is ignoring my message!

The output I get, using an empty form is:

Code:
'' is an empty string!
A password é de preenchimento obrigatório!
O endereço de correio electrónico indicado não é válido!
The other validations are getting the right message from 'messages' but the AlNum filter isn't working...

PHP Code:
[...]
$validators = array(
                
'login'           => array(
                                        
'AlNum',
                                        
'presence' => 'required',
                                        
'messages' => 'O login apenas pode conter caracteres alfanuméricos [a..z][A..Z][0..9]!'
                                        
),
                
'password'    => array(
                                        
'presence' => 'required',
                                        
'messages' => 'A password é de preenchimento obrigatório!'
                                        
),
                     
'email'          => array(
                                        
'EmailAddress',
                                        
'presence' => 'required',
                                        
'messages' => 'O endereço de correio electrónico indicado não é válido!'
                                        
),
[...] 
Bug? Or am I doing something wrong?

NOTE: If i change AlNum to EmailAddress or remove that filter I get the right text.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-16-2007, 09:33 AM
Member
 
Join Date: Aug 2007
Location: Tarnow/Krakow, Poland, EU
Posts: 30
Default

Try Alnum instead of AlNum.
__________________
I don't trust anything that bleeds for five days and doesn't die.
www.inetive.pl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-16-2007, 12:15 PM
Junior Member
 
Join Date: Aug 2007
Posts: 2
Default

Same result. The validation is working, it's just ignoring my message...
I'll have a look at the Zend_Filter classes maybe I can find out what's the difference between Alnum and the others...

EDIT: It's working now. I thought there was only one message needed per rule, but I had to submit one message per internal message of the filter to get it working. (In the Alnum case, The EmailAdress works fine as it is...)

PHP Code:
[...]
$validators = array(
                
'login'        => array(
                                        
'AlNum',
                                        
'presence' => 'required',
                                        
'messages' => array(
                                                
Zend_Validate_Alnum::NOT_ALNUM => 'O login apenas pode conter caracteres alfanuméricos [a..z][A..Z][0..9]!',
                                                
Zend_Validate_Alnum::STRING_EMPTY => 'O login é de preenchimento obrigatório!'),
                
'password'    => array(
                                        
'presence' => 'required',
                                        
'messages' => 'A password é de preenchimento obrigatório!'
                                        
),
                     
'email'          => array(
                                        
'EmailAddress',
                                        
'presence' => 'required',
                                        
'messages' => 'O endereço de correio electrónico indicado não é válido!'
                                        
),
[...] 

Last edited by kias : 08-16-2007 at 01:01 PM.
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 02:50 PM.