0

I have languages file form_validation_lang.php with a standard errors messages in array.

I added some own messages here:

$lang['my'] = "Enter vacancy name"; 

I have form validation:

$this->form_validation->set_rules('vacancy', 'here load text from field my', 'required');

I want to display only text from $lang['my'] when my field is not filled.

2
  • 1
    Having never done this, my first guess would be to create your own version of the system language file form_validation_lang.php in the application directory. Commented Sep 7, 2015 at 15:48
  • you can use $this->form_validation->set_message(); Commented Sep 7, 2015 at 16:46

1 Answer 1

2

You can set messages for certain rule, make form_validation.php inside application folder as @Craig mentioned above:

$lang['form_validation_required']       = 'Yep, that {field} is required and has custom message.';

You can place rules message inside controller:

$this->form_validation->set_message('integer', 'There must be an integer.');

And you can also set message for one of the rules among others:

$this->form_validation->set_rules('email', 'Your email', 'required|valid_email',
    array('valid_email' => 'Watch out, it should be email')
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.