On Monday, 10 February 2014 15:53:45 UTC+1, Slawomir Wawak wrote:
Hi!
I try to create some validation to my form. I followed some forums and blogs looking for solution, but nothing helps.
My controller looks like this:public function add() {
if ($this->request->is('post')) {
$this->Student->create();
if ($this->Student->validates()) {
.....
The above is attempting to validate an empty Student object - Student doesn't have any form data in it. You are missing:
$this->Student->set($this->request->data)
or similar.
When I enable "required => true" form fails each time, even when correct.
Because the form data isn't in/on the model - you're validating nothing.
When I show debug($this->Student->data) all data is there.
Where are you doing that?
AD
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment