CodeIgniter Forums
Form Validation / Removing values from $_field_data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forum-17.html)
+--- Thread: Form Validation / Removing values from $_field_data (/thread-63757.html)



Form Validation / Removing values from $_field_data - skunkbad - 12-07-2015

In CI2 I was able to remove values from $_field_data, and subsequent calls to set_value() for a particular field would then return an empty string. I find this handy, because on some forms I could unset the entire $_field_data array when a form submission was successful, and instantly show an empty form for a new submission.

In CI3 this isn't working. I can verify that the $_field_data is unset, but calls to set_value() for a particular field that was unset will still show the value.

Rather than try to figure out what's going on by myself (not because I'm lazy but just lack the time), I was hoping that somebody could shed some light on this issue. What's the cleanest way to unset the data so that set_value() doesn't have anything to repopulate?

EDIT -------------------------------------------------------

It didn't take long to figure out the problem, and it was the way that CI determines if the form validation object contains the value before switching to $_POST values. I was able to figure out a solution, but it really changes the way set_value() works. I don't like it, but it is what it is.