Welcome Guest, Not a member yet? Register   Sign In
Form_validation message[SOLVED]
#1

[eluser]Ivar89[/eluser]
Hi,
I have a contact form with some required fields And standard induvidual message is:
The "field name" field is required.

Now I want to change it to something else...and its not working
I need to change every field induvidually and if I use:
Code:
$this->form_validation->set_message('required',  'Niet alle velden zijn correct ingevoerd.');
It changes ALL fields with the rule required to that message
but is there a way I can set a message not connected to a rule but to like an ID??
I can't find this in the user guide.

Thanks in advance.
#2

[eluser]steelaz[/eluser]
You can create validation callback function for this particular field and set your own message.
#3

[eluser]Ivar89[/eluser]
OMG so simple ofcourse!Tongue
I only used callback to validate if a field was true or falseTongue

but eeuhm its about 6 fields or so...then I have to make 6 function just for that...
#4

[eluser]cahva[/eluser]
Excuse me, but why do you want to change required message different for every field? Doesnt make sense. If you meant that you dont have the field name when you use set_message? Do you just need to translate the text to your language? Then add your own language to system/language/[your language]/form_validation.php

..or (havent tested this) use the placeholder(%s) in your message:
Code:
$this->form_validation->set_message('required',  '%s Niet alle velden zijn correct ingevoerd.');
#5

[eluser]Ivar89[/eluser]
cahva saved my day:p

thanks




Theme © iAndrew 2016 - Forum software by © MyBB