hi i am using codeigniter
, i use codeigniter
form validation . i have a input called pric开发者_StackOverflow社区e
<input id="Price" name="price" class="textbox-small Verdana11-424039" type="text" name=""
tabindex="1900" />
i validate price like this
this->form_validation->set_rules('price', 'Price', 'trim|required');
but i want to validate price to take only numbers , commas and dots
like this .
1000
1000.00
1,000.00
how can a custom validation like this accomplished by codeigniter , please help......
There is a callback function option when using form validation in codeigniter. You can write your own function inside the controller which checks for your price using regex, and then you can set that function/method as the callback function name when you set form validation rules.
You can read more at http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks
精彩评论