Bug fix for the validateRequired / validateNotEmpty:

    function _evaluate($validation, $messageOnFail, $fieldName = null,
$params = array())
    {
        if ($validation)
        {
            return true;
        }

        if(!preg_match("/does not match pattern/",$messageOnFail) && !
preg_match("/should not be empty/", $messageOnFail))
        {
                if (!isset($params['message']))
                {
                    $params['message'] = Inflector::humanize($fieldName) . "
" . $messageOnFail . ".";
                }

                if ($params['message'])
                {
                    $this->model->validationErrors[$this->name][$fieldName][]
= $params['message'];
                }
        }
        $this->errorCount++;
        return false;
    }

That part at least should be fine, still working on the other chunks
of code.

On Feb 8, 3:14 pm, "MrTufty" <[EMAIL PROTECTED]> wrote:
> Damn, I didn't pick that one up either. Will bug fix that later on.
>
> A possible modification would be to add an extra parameter to each
> function specifying whether or not to output the message - but that
> might make things more complicated than they need to be.
>
> When I get this sorted out and working in a way that makes sense to
> everyone, I'll post it up somewhere as a complete package to drop in.
> And probably stick it up on the Bakery or Trac, if enough people are
> interested in seeing it there.
>
> On Feb 8, 2:18 pm, "mcgordon" <[EMAIL PROTECTED]> wrote:
>
> > Good catch. I hadn't considered the default messages getting added to
> > the array.
>
> > Be careful of validateRequired calling validateNotEmpty. You'll want
> > to add a check for that error message as well or you'll see both
> > "field should not be empty" and "field is required" for the same field.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to