Bug Report #4422
[Validation] decimal message doesnt use :param2 value
| Status: | New | Start date: | 01/30/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | Core | |||
| Target version: | - | |||
| Resolution: | Points: | 1 |
Description
Here is quick example:
$data = array(
'float' => '123.45',
);
$valid = Validation::factory($data)->rule('float', 'numeric', array(':value', 2, 4));
if (! $valid->check()) {
echo Debug::vars($valid->errors('validation'));
}
This will produce an error:
"float must be a decimal with 2 places"
But this is incorrect message for checked value. May be we need a special method like Validation::error_message($rule, $params), which will analyze param count? And something like this in message files:
'decimal' => array( 'default' => ':field must be a decimal with :param2 places', // default message '3' => ':field must be a decimal in :param3.:param2 format', // 3 params message ),