Created
August 18, 2011 16:35
-
-
Save dholmes/1154476 to your computer and use it in GitHub Desktop.
[zf] Quick and dirty validating field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$color = new Zend_Form_Element_Text('color'); | |
$color->AddValidator('Regex',false,array('/^\#[a-f0-9]{6}$/i')); | |
$color->getValidator('Regex')->setMessages( array( | |
Zend_Validate_Regex::NOT_MATCH => | |
'\'%value%\' is not valid. Use a value in the form of #112233' | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment