I'd like to change the data in my form when a certain validation rule
changes, but no matter what the original value remains. Here's what
happens:
1. Form is submitted
2. Data is passed to model
3. Model validates, if it fails I alter the value of that field in the
validation method and return false, eg:
public function isNotMeh() {
if ($a != $b) {
debug($this->data);
$this->data[$this->alias]['a'] = 'meh';
debug($this->data);
return false;
}
return true;
}
4. In my controller I manually set the data to the view, eg
if (!$this->Model->saveAll($this->data)) {
$this->set('data', $this->Model->data);
}
I see what I would expect from the 2 calls to debug above in the
browser, but the form fields are always the same as they were posted.
Is there some hidden data somewhere I need to reset, perhaps in the
Form helper?
Cheers,
Jon
--
jon bennett - www.jben.net - blog.jben.net
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en