Welcome Guest, Not a member yet? Register   Sign In
Unset rule in Form Validation
#3

(11-04-2014, 03:09 PM)Isterklister Wrote: I need to unset rules and result in Form Validation helper.

This will clear the entire form validation data, including rules, values, errors, etc.

Create a file called MY_form_validation.php in your application/libraries folder. In that file, put the following code:
PHP Code:
class MY_Form_validation extends CI_Form_validation {

  public function 
__construct()
  {
    
parent::__construct();
  }

  public function 
clear_field_data()
  {
    
$this->_field_data = array();
    return;
  }


When you want to clear the form validation data, just invoke the method, like this:
PHP Code:
$this->form_validation->clear_field_data(); 

That is useful when you want to process data and then show the same form again -- but blank -- to receive new data, like when you're adding one customer record after another.
Reply


Messages In This Thread
Unset rule in Form Validation - by Isterklister - 11-04-2014, 03:09 PM
RE: Unset rule in Form Validation - by benedmunds - 11-11-2014, 06:12 PM
RE: Unset rule in Form Validation - by RobertSF - 11-11-2014, 07:19 PM
RE: Unset rule in Form Validation - by raenk - 05-07-2015, 06:16 PM
RE: Unset rule in Form Validation - by carsten - 09-30-2015, 10:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB