QuickForm_Controller: Resetting form data?
| From: | Jeff Schmidt | Date: | Fri, 07 May 2004 20:08:32 +0000 |
| Subject: | QuickForm_Controller: Resetting form data? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12354@lists.php.net to get a copy of this message | ||
Hello,
I am using QuickForm_Controller to implement a front-end to a database table for user profile information (so nothing too exotic here). I want to let the user enter multiple profiles, if they so desire (for example, the profile information is for a directory of consultants - a given consulting firm might have one person who maintains the profile information for all the consultants in the firm, instead of having every consultant go to our site and add the information for themselves).
I have a page where the user can view the profiles that they created, and there is a link to create a new profile. I think for existing profiles, I can pass the profileID (integer key for the record for that profile) as part of the url, as a get variable. (For example profile.php?profile=29345). Then, I can lookup the profile info using that key, and and use that data to set the default values for the form.
However, I'm not sure how to tell the form to reset itself to all the default values, and then display itself. I know there is a way to place a reset button on the page, but that's not what I'm looking for here.
To better illustrate the problem, consider the following example.
The user creates a profile. They fill in all the info, submit it, the data gets added to my database, then they go back to the 'profile management' page. They click the link to "Create a new profile" - As it currently is, when the form loads, it will still show the data they just entered into the form for the last profile. I want to have it started out either blank, or if they clicked on a profile instead of the create new link, I want to have the page display the values that I set as default from the database.
Jeff Schmidt
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc