2

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 Answers 2

4

Callbac ks are your friend

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

Sign up to request clarification or add additional context in comments.

1 Comment

You don't have to use a callback function either. You can also extend the form validation class (create a MY_form_validation) and write your own custom functions that can be used whenever your load the form validation. I find that to be much more coherent.
0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.