Codeigniter form_validation create custom rule/filter

安稳与你 提交于 2019-12-11 03:55:00

问题


Codeigniters form_validation is great, however I need a custom filter that is specifically

alpha space dash and apostrophe/single quote

but.. they don't have that specifically in there existing set, so I am wondering how could I go about creating my own rule/filter and adding it to form_validation.


回答1:


Callbac ks are your friend

You'll just just a custom callback - and put a regex in there that does whatever rule you want.




回答2:


Here is some documentation for CodeIgniter's form validation tool.

http://codeigniter.com/user_guide/libraries/form_validation.html#validationrules



来源:https://stackoverflow.com/questions/10840382/codeigniter-form-validation-create-custom-rule-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!