Welcome Guest, Not a member yet? Register   Sign In
How to change the form validation language
#1

Dear all,

I am new in CI.

I am trying to develop an application with dual language. No doubt that form validation ,set_rules method generates message in english language, but i want to display message in the language being selected. If the user select language as English the message should be displayed in English language and if the user select language as french then the message should be displayed in french.

Could anyone assist me on how to do that ?

Thanking you in advance!!
Reply
#2

U can set your message for individual rules:
PHP Code:
$this->form_validation->set_message('rule''Error Message'); 
ex.
PHP Code:
$this->form_validation->set_message('require''Fields are required!'); 
Reply
#3

Set your error messages in the language files for each language, then use lang('error_message_name') to retrieve the message when calling set_message() or when setting the messages in the rule array.

Additionally, you can use 'lang:label_name' when setting the label parameter (in the array or in the second parameter of set_rules) to tell the library to retrieve the name of the label from the language file.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB