Welcome Guest, Not a member yet? Register   Sign In
Form Helper - set_value()
#3

(08-29-2015, 04:03 PM)RobertSF Wrote: When someone checks the checkbox, and they get a new form to fill out, you want the fields all empty, not with the values that were entered in the previous instance of the form?

If yes, I did this. It involved extending the form validation library by creating a file called MY_form_validation.php in my application/libraries folder, and inserting this code.


PHP Code:
<?php
class MY_Form_validation extends CI_Form_validation {

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

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


So to clear out the fields, use $this->form_validation->clear_field_data()

Answer: Yes

I was hoping there was a way to do it without extending the CI framework, (Trying to do as little of that as possible), but this way is definitely better than my way, thanks!
Reply


Messages In This Thread
Form Helper - set_value() - by jLinux - 08-29-2015, 12:02 PM
RE: Form Helper - set_value() - by RobertSF - 08-29-2015, 04:03 PM
RE: Form Helper - set_value() - by jLinux - 08-29-2015, 07:10 PM
RE: Form Helper - set_value() - by jLinux - 08-30-2015, 09:16 AM
RE: Form Helper - set_value() - by jLinux - 08-30-2015, 09:36 AM
RE: Form Helper - set_value() - by RobertSF - 08-30-2015, 09:49 AM
RE: Form Helper - set_value() - by jLinux - 08-30-2015, 10:15 AM
RE: Form Helper - set_value() - by RobertSF - 08-30-2015, 10:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB