Hi
I use the validator in the form:
//...
->addValidator(
'Db_NoRecordExists', true,
array('table' => 'users', 'field' => 'username', 'messages' => array(
'recordFound' => 'Username already exists!'
)
)
)
Cheers
holo
2009/8/3 flow <[email protected]>
>
> Hi,
>
> I want to use Zend_Validate_Db_NoRecordExists to check if a username
> already
> exists.
> Actually I set the validator in the edit and in the new Action of the
> userController.
>
> Validator in newAction()
>
> // Set validator
> $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('user',
> 'username');
> $form->username->addValidator($db_lookup_validator);
>
>
> Validator in editAction()
>
> // Set validator
> $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('user',
> 'username', array('field' => 'id', 'value' => $id));
> $form->username->addValidator($db_lookup_validator);
>
>
>
> I want to know if this is the correct way to do this?
> Or is there a way to get the hole validation thing in the user form?
>
> Thank you very much,
> greets B.
> --
> View this message in context:
> http://www.nabble.com/Zend_Validate_Db_NoRecordExists-tp24787176p24787176.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>