Reputation: 255
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.
Upvotes: 0
Views: 197
Reputation: 3710
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')
);
Upvotes: 2