php - Codeigniter - adding multiple custom validation -


is possible add 2 or more custom validation functions using same field?

$this->form_validation->set_rules('myfield', 'my field','required|my_method1|my_method2'); 

eg. my_method1 check string format , my_method2 check existence of string in database.

seems first method works , second 1 ignored. because i'm using same parameter both functions?

thanks.

you can!

in each my_method_n($x) function, must inform them prefix name callback_, instance: callback_my_function1|callback_my_function2.

take @ question explains how can use multiple callback functions , syntax in manual.

codeigniter form validation multiple callbacks

http://www.codeigniter.com/user_guide/libraries/form_validation.html?highlight=form_validation#callbacks-your-own-validation-methods


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -