• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about forms native rules that are available to use

#1
Hi, CI have the following native rules that are available to use; alpha, alpha_numeric, alpha_numeric_spaces, alpha_dash and so on... but what if I want to validate a form field for a title or subject with the following common characters; ? ! $ & @

Is there a way to add those to the following native rules; alpha_numeric, alpha_numeric_spaces?

Thank You!
Reply

#2
You could extend the form library and then replace the native rules you want to change, but it would be easier to just create your own validation rules, which doesn't require extending the library. See this section in the documentation. I think it's what you need.
http://www.codeigniter.com/userguide3/li...on-methods
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply

#3
(04-01-2015, 11:58 PM)RobertSF Wrote: You could extend the form library and then replace the native rules you want to change, but it would be easier to just create your own validation rules, which doesn't require extending the library. See this section in the documentation. I think it's what you need.
http://www.codeigniter.com/userguide3/li...on-methods

Great! Thank You!
Reply

#4
PHP Code:
$this->form_validation->set_rules('q''Q''regex_match[/.*([?!$&@]).*/]'); 
Reply

#5
That's an even better reply, gadelat!
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply

#6
OOnly,when you are able to extend library.
Rolleyes
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.