Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error message
  • What do you mean "in modal"? Modals are front-end technology, Fuel doesn't do those.
  • thanks for replying.,
    i just misspelled that word.
    Actually i am asking in the model not modal...
  • ok, messages for what exactly? validation messages? what does your model look like (post it on http://bin.fuelphp.com and paste the link here),
  •  I would like to override the error message in the model.
  • HarroHarro
    Accepted Answer
    Validation error messages are defined per rule, not per field.

    There is a workaround, you can pass a custom message when you process the validation errors. You can do this in a method of the model, so you keep it all in a single class.

    foreach ($val->error() as $field => $error)
    {
        switch ($error->field)
        {
            case "fieldA":
                $msg = $error->get_message('Custom message with parameters here');
            break;

            default:
                $msg = $error->get_message();
        }
        // do something with the $msg
    }

Howdy, Stranger!

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

In this Discussion