Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Custom validation error message for each field
  • Hi,

    Is it possible, with the current validation class to set the multiple validation errors for multiple fields and one rule?

    I use the following:

    $val->add_field('login', 'Login', 'required|trim|min_length[5]|max_length[32]|unique[accounts.login]');
    $val->set_message('unique', 'This login is already taken. Please choose another login.');
    $val->add_field('email', 'Email', 'required|trim|valid_email|unique[accounts.email]');
    $val->set_message('unique', 'This email address is already taken. Please choose another email address.');

    The "unique" rule is used twice for one validation run but only one message (first) will be set for this field error. So the question is - is it possible to customize the message per field for the same rule?

    Regards
  • HarroHarro
    Accepted Answer
    No, at the moment the message is linked to the rule.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion