CodeIgniter Forums
Form generation library repopulate problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Form generation library repopulate problem (/showthread.php?tid=4519)



Form generation library repopulate problem - El Forum - 11-29-2007

[eluser]CodeIgniter Fan[/eluser]
I am using form generation library for creating form. When I submit form, the form generation library repopulate my form also if form is validated successfully. So please help me, my form should not be repopulated after it is validated to true. I also tried validation class set_fields method to set the form elements to null "" but it is not working.


Form generation library repopulate problem - El Forum - 11-29-2007

[eluser]CodeIgniter Fan[/eluser]
Ok I solved by adding one function to form generation library file

Code:
function set_values($data)
{
  foreach($data as $ind => $value)
     $this->_inputs[$ind]['value'] = $value;
}

I am calling this function if validation is successfull and setting fields value to null "".