Skip to content

Instantly share code, notes, and snippets.

@robertbasic
Created March 2, 2011 06:58
Show Gist options
  • Save robertbasic/850580 to your computer and use it in GitHub Desktop.
Save robertbasic/850580 to your computer and use it in GitHub Desktop.
Basic Zend_Dojo_Form
<?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