ZF-2453: Behaviour of Zend_Validate_Input messages is not intuitive
Description
Get error Zend_Validate_Exception: No message template exists for key '' when attempting the intuitive approach:
example:
$validators = array(
'month' => array(
'alpha',
'messages' => 'A month must consist only of letters'
),
'year' => array(
'digits',
'messages' => 'A year must consist only of numbers'
)
);
Closer reading of the docs suggests that the following works:
example:
$validators = array(
'month' => array(
'alpha'
),
'year' => array(
'digits'
),
'messages' => array (
1 => 'A month must consist only of letters',
2 => 'A year must consist only of numbers'
)
);
Also, if this interpretation is correct what approach should one adopt if there is a form field called 'messages'.
Thanks, Ian Lewis
Comments
Posted by Wil Sinclair (wil) on 2008-04-18T16:55:02.000+0000
Please evaluate and categorize/assign as necessary.
Posted by Benjamin Eberlei (beberlei) on 2008-11-15T10:05:18.000+0000
This issue is also an issue of Zend_Filter_Input as far as i understood it. Recategorized.
Posted by Benjamin Eberlei (beberlei) on 2009-01-07T16:49:55.000+0000
This is more a problem of the bad API of complex Zend_Filter_Input objects.
The solution to this problem is more of a documentation issue (of the bad API). Changes are only possible for 2.0
Posted by Ralph Schindler (ralph) on 2009-01-10T11:04:35.000+0000
reassigning, matthew ideas?
Posted by Thomas Weidner (thomas) on 2009-08-27T14:54:11.000+0000
I just tested this...
Actually both approaches are usable. Within the testbed the following is checked and works:
Posted by Thomas Weidner (thomas) on 2009-08-27T14:54:58.000+0000
Seems to be fixed with one of the previous commits. Therefor closing this issue as fixed with the next minor release.