2

I want to display validation message in "arabic" so i used:

$this->form_validation->set_message('required','my message');    

but this will return "my message" only.

is there a way to add label for each field within my message so it's look like.

label "my message"

example:

<input type="text" name="field1">
<input type="text" name="field2">

output:

field1 my message
field2 my message

1 Answer 1

2

This is in the user guide;

If you include %s in your error string, it will be replaced with the "human" name you used for your field when you set your rules.

https://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#settingerrors

You would change your code, to this;

$this->form_validation->set_message('required','%s my message');

This would then use the name of the filed, you set in the validation rules.

Or, you could translate the field names;

https://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#translatingfn

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.