HTML_QuickForm - enabling/disabling group-elements before displaying form
| From: | Tommy Ipsen | Date: | Wed, 02 Jul 2003 13:31:42 +0000 |
| Subject: | HTML_QuickForm - enabling/disabling group-elements before displaying form | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6386@lists.php.net to get a copy of this message | ||
Hi
I'm using QuickForm as part of a small CMS system and need to control which submit-buttons are being displayed depending on a parameter from the user AS WELL AS results from processing the form!!
It's like this:
parameter action can be either "Create" or "Modify" matching the following buttons:
Create -> Reset and Save buttons
Modify -> Reset, Delete and Save/Update buttons
this would normally be easy to do like this:
//new Quickform-object
//add elements, rules and stuff
if ($action=='create') {
//add group of create-buttons
} else {
//add group of modify-buttons
}
//process form ($form->validate, $form->process)
//show form ($form->toHTML)
but my problem is that when processing the form certain results/cases could change the behaviour in such a way that even though $action is 'modify' the create-buttons should be displayed!!
I could move the button-group part of the code below the process-part but this somehow seems logically wrong I think. I would would rather like to enable/disable the two button groups from within the process function - is this possible!?
Regards,
Tommy