Hi,
I'm using the Advanced Validation approach by CakeBaker
(http://wiki.cakephp.org/tutorials:advanced_validation), and trying to
get errors to display properly if a save() fails. In a nutshell, it
doesn't display errors because the FormHelper expects
HtmlHelper::tagIsInvalid() to return 1 if there is an error.
Advanced Validation sets the $validationErrorrs[$model][$field] to a
_string_ value if I provide an error message.
However, when I use the FormHelper's generateFields() function and it
generates tags / errors, it requires tagIsInvalid to return the number
1:
function isFieldError($field) {
$error=1;
$this->Html->setFormTag($field);
if ($error == $this->Html->tagIsInvalid($this->Html->model,
$this->Html->field)) {
return true;
} else {
return false;
}
}
But HtmlHelper::tagIsInvalid() returns the error string I set above,
not the number one. The documentation says it returns true on errors,
but it doesn't:
function tagIsInvalid($model, $field) {
return empty($this->validationErrors[$model][$field]) ? 0 :
$this->validationErrors[$model][$field];
}
Thus, isFieldError() always returns false, and the FormHelper class
will refuse to display any error messages.
I could be wrong here, but is there something I'm missing or should
tagIsInvalid() return 1 instead? I'm still a little foggy on the
validation stuff, since I need to use Advanced Validation to use
multiple error messages for the same field. Any insight would be
helpful.
Thanks,
Shutter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---