Form_validation message[SOLVED]

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:
$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.

You can create validation callback function for this particular field and set your own message.

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...

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:
$this->form_validation->set_message('required',  '%s Niet alle velden zijn correct ingevoerd.');

cahva saved my day:p


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.