I try to get validation working on a register-form in my application.
Because it did not work at all, I tried it on a very simple form with
only a username field (it's called 'gebruikersnaam' in the code
because i'm belgian).
I allready did var_dump on $this->data and $this->Member-
>invalidFields(). $this->data does contain input after a submit.
invalidFields() does contain nothing if I submit a blank form.
I also don't get any errors.
Is it maybe necessary to call save() in the function to activate
validation?
In my members_controller.php i have this empty function:
public function registreren()
{
}
In my model I have:
var $validate = array(
'gebruikersnaam' => array(
'rule' => 'notEmpty',
'message' => 'Kies een gebruikersnaam.'
)
);
and in the view I do:
echo $form->create( 'Member', array('action' => 'registreren',
'inputDefaults' => array('div' => false)) );
echo $form->input( 'gebruikersnaam' );
echo $form->end('Registreer!');
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment