Welcome Guest, Not a member yet? Register   Sign In
Clear form fields after validation passes
#1

[eluser]LifeSteala[/eluser]
Hey all,
I've searched the forums for this but was unable to find anything related.

Is there anyway to clear all form fields after a validation process has passed? Typically you would redirect away to another page, but I need it to come back to the form page with an empty form.

Thanks
LS
#2

[eluser]Armchair Samurai[/eluser]
Try unset($_POST)
#3

[eluser]LifeSteala[/eluser]
Thanks for your reply, no that would not work. The form fields have

Code:
set_value('field_name')

set as the value for each field. Any other idea's?

Thanks
LS
#4

[eluser]Evil Wizard[/eluser]
you could try implicitly setting the default value for each of the fields to a zero byte string, i.e. '' or NULL
#5

[eluser]Thorpe Obazee[/eluser]
http://ellislab.com/forums/viewthread/119291
#6

[eluser]TheFuzzy0ne[/eluser]
When the form has been processed successfully, simply redirect back to the form again, rather than a different location.
#7

[eluser]alank64[/eluser]
I have searched for this as well and only found after going through the validation.php class.

I know this post is outdated but for the record... or in case I forget in 2 days

Code:
$this->validation->fullname="";
$this->validation->address="";
$this->validation->email="";

You can do this in your controller on a successfull messages before you do $this->load->view().




Theme © iAndrew 2016 - Forum software by © MyBB