Created
March 2, 2011 06:58
-
-
Save robertbasic/850580 to your computer and use it in GitHub Desktop.
Basic Zend_Dojo_Form
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 | |
class My_Form extends Zend_Dojo_Form | |
{ | |
public function init() | |
{ | |
$this->addElement( | |
'ValidationTextBox', | |
'title', | |
array( | |
'label' => 'Title:', | |
'missingMessage' => 'You have to enter something', // overriding the default "This value is required." | |
'promptMessage' => 'Enter a title', // on focus | |
'invalidMessage' => 'Type some random characters, 3 min, 100 max', // error message for the failed regExp | |
'regExp' => '.{3,100}', // regexp for validation | |
'required' => true, | |
'validators' => array( | |
array( | |
'validator' => 'StringLength', 'options' => array(3, 100) | |
) | |
), | |
'filters' => array( | |
array( | |
'filter' => 'StringTrim', | |
'filter' => 'StripTags' | |
) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment