QuickForm: How do I reset a value ?

From: Date: Mon, 13 Feb 2006 21:58:56 +0000
Subject: QuickForm: How do I reset a value ?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22951@lists.php.net to get a copy of this message
I have a simple form, that the user fills in, it passes validation, I put the values in a database, I then want to present the same form to the user so that they can fill some more values in, wash/rince/repeat. It all works, except that the second time round the user is presented with the data that they entered last time - I want them to see a nice empty form. I have tried various solutions: After: $form->validate() I go: foreach(array('user_name', 'real_name', 'password1', 'password2') as $field) { $fp = &$form->getElement($field) $fp->setValue(''); } The above works for a field that does not have a value submitted as part of a form (eg a header element). I have also tried: $val = &$form->getElementValue($field); $val = ''; I could not work out how to make HTML_QuickForm_reset() do anything. I am sure that there must be a way of doing it. I don't want to regenerate the entire form if I can help it. The somewhat sparse documentation does not really help. TIA -- Alain Williams Parliament Hill Computers Ltd. Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ #include <std_disclaimer.h>

« previous php.pear.general (#22951) next »