Welcome Guest, Not a member yet? Register   Sign In
Dynamically changing validation rules
#1

[eluser]mTuran[/eluser]
Firstly i have validation rules for my controller in $config folder. I can use validation system like that, there is no problem. Problem starts when i add extra input by javascript. Input name is "i_city". This input activates only when you select my country from dropdown list. In this point i can't add i_city validation rules to $config because all of my client will not select my country and because of that i_city input will be behind as invisible at page.

I tried that code for add validation for i_city input but isn't working because of i use $config rules.

Code:
//if (isset($_POST['i_city']))
   //$this->form_validation->set_rules('i_city', 'lang:city', 'trim|required|xss_clean');

What you suggest ?
#2

[eluser]Thorpe Obazee[/eluser]
Try using a callback then do the checking.




Theme © iAndrew 2016 - Forum software by © MyBB