• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question About Validation Class

#1
[eluser]gedev2006[/eluser]
Hi

I know you can set rules to the validation class as such:

$rules['item_name'] = "trim|alpha"

and so forth

WHat i need to have is a field that allows alpha_dash, and allow the bracket symbols ().But the only way i can get the brackets in is alpha or alpha_numeric but then the alpha_dash doesnt work correctly

any ideas?

cheers

g

#2
[eluser]Colin Williams[/eluser]
Do a custom callback method.

#3
[eluser]gedev2006[/eluser]
Yeh i thought of that, but then would you check the rules the exact same way ??

Also, in the custom error fields say:

$fields['zip'] = "Zip Code";

Codeigniter adds its own message to the end so the output of the error would read something like

Zip Code field may only contain alpha-numeric characters.

How do i prevent code igniter adding "field may only contain alpha-numeric characters." to the end so its a completely custom error message. $this->validation->set_message ( "zip", "bla bla" ) does nothing!

#4
[eluser]Colin Williams[/eluser]
The set_message method needs the name of the callback method as the first param, not the name of the field.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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