Blog Archives

Registration form- #zf (finished)

so far so good, the registration form is finished, worked a little bit with #validators and #decorators, pretty cool..had some problems getting the errors and customizing the errors messages, did another intensive search on google and found the solution, it was pretty simple..
this is part of my source code:

$u_email= new Zend_Form_Element_Text(‘email’);
$u_email->setRequired(true)
->setAttrib(‘size’, ‘25’)
->addValidator(‘NotEmpty’,true,array(‘messages’ => array(‘isEmpty’ => ‘custom message’)))’

as we can see one way of doing this is to pass a third parameter into addValidator,this third parameter is an array containing the new message and the property to which it will be applied.
with a simple call to getMessages() we can get the messages of the form in case a field is flag as invalid.

Advertisements

Registration form-zf

creating the registration form using zendframework,had a little problem validating the fields..I had to do some intensive research on google to find the solution..ZF is great although the doc is not that intuitive..the learning curve is slower compare to anothe frameworks..

Still loving it though.