hi i am using codeigniter form validation , i want to add a custom form validation for my price
field
i am trying this
in controller
$this->ci->form_validation->set_rules ( 'price', 'Price', 'callback_test' );
and i have function
private function test()
{
echo "hello"; die ;
}
i am trying to add a custom call back url test
here . but is not working
i am trying this example
http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks
but i do like this the validation works
$this->ci->form_validation->set_rules ( 'price', 'Price', 'required' );
why is my call back url function does not working . please help me . thanks..............
You custom callback function needs to return either TRUE or FALSE to work correctly. Also, putting a
die()
statement doesn't really help you here...This is a trivial code example but I hope you get the picture:
$string
is the value coming from the input->post and is automatically passed to your callback function. You also need to specify an error message to this callback, otherwise you'll get an error of "no error message provided for custom field", or something like that.