Validation from controller question.

2010-06-03 Thread Roland Pish
Hello.
I need to do this validation in a field in a controller:

$this-Model-set($this-data);
if ($this-Model-validates(array('fieldList' =
array('some_field' {

  // code to create other fields and send an email
}

Then (as it nothing happened above) I call $this-Model-save($this-
data); as a normal call with the whole validation process executed
again (by save method).

But after save method call, errors from other fields are showing up.

What I need is only perform the validation of some_field to execute
some code, and then continue to the save method performing again the
whole validation, but as mentioned above, errors from other fields are
showing up and not validating.

What should be the correct way to achieve what I want?

Thanks in advance.

Regards

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation from controller question.

2010-06-03 Thread Roland Pish
Sorry for the noise. I found what I was doing wrong.
I was calling the Model-validates() before tweaking another fields
data (whose errors were shown up).
Now I call the Model-validates() immediately before the Model-save()
and now it's working as expected.

Cheers.

On 3 jun, 11:54, Roland Pish rolandp...@gmail.com wrote:
 Hello.
 I need to do this validation in a field in a controller:

 $this-Model-set($this-data);
 if ($this-Model-validates(array('fieldList' =
 array('some_field' {

   // code to create other fields and send an email

 }

 Then (as it nothing happened above) I call $this-Model-save($this-data); 
 as a normal call with the whole validation process executed

 again (by save method).

 But after save method call, errors from other fields are showing up.

 What I need is only perform the validation of some_field to execute
 some code, and then continue to the save method performing again the
 whole validation, but as mentioned above, errors from other fields are
 showing up and not validating.

 What should be the correct way to achieve what I want?

 Thanks in advance.

 Regards

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en