dontHaveName
dontHaveName

Reputation: 1937

kohana custom validation error message

I have a callback within kohana validation. I'm sending error message this way:

    public function way(Validate $array, $field)
    {
        if (something)
        {
            $array->error($field, 'super error message', array($array[$field]));
        }
    }

It works but when I print out the message

echo $errors['field'])

it returns formName.field super error message

How to get rid of formName.field?

Upvotes: 2

Views: 507

Answers (1)

Faraz
Faraz

Reputation: 761

These are messages configured in Kohana Core or in Modules or Application. You can change them in messages folder e.g. default validation message are in System -> messages -> validation.php you an copy this file in your application and remove :field from them it will get rid of field name.

'not_empty'     => ':field must not be empty',

change it to

'not_empty'     => 'must not be empty',

Upvotes: 1

Related Questions