Codeigniter form_validation create custom rule/fil

2019-07-11 19:28发布

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.

2条回答
孤傲高冷的网名
2楼-- · 2019-07-11 19:43

Callbac ks are your friend

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

查看更多
等我变得足够好
3楼-- · 2019-07-11 19:55

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

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

查看更多
登录 后发表回答