views:

159

answers:

1

Hi all i have below code

$name = new Zend_Form_Element_Text('name');
$validator = new Zend_Validate_Db_NoRecordExists('clients', 'name');
$validator->setMessage('A record already exists');
$name->addValidator($validator);
$name->setLabel('Name');
$name->setRequired();
$name->setDecorators($decorator->elementDecorators);

if i enter abcd it is ok no error ... but if i enter ab cd then it should show validation message... Is there any REGEX validation for use Zend_Validate_Regex()

Pls help

Regards Nisanth

A: 

you can add another validator like

Zend_Validate_Alnum();

by default it doesn't allow white spaces but you can change it as well

the documentation said :

This validator includes an option to also consider white space characters as valid.

tawfekov