QuickForm and hidden field type
| From: | xav | Date: | Fri, 11 Oct 2002 11:58:52 +0000 |
| Subject: | QuickForm and hidden field type | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2478@lists.php.net to get a copy of this message | ||
Hello all,
I got a problem with hidden fields in Quickform.
I want to create an hidden field value on a condition and Quickform
doesn't seems to agree with me ;)
Just have a look at the code below, when I call it with a get param
called "action" the hidden field should be created and set action to
"domodif" but it only returns "modif" .
If I rename the hidden field to whatever else, it works fine...
Am I doing a big mistake ? or is it a bug ?
Thanks
--
xav
--------------------------------------------------------------
<?
require_once('HTML/QuickForm.php');
if ($_GET['action']) $action = $_GET['action'] ;
elseif ($_POST['action']) $action = $_POST['action'];
else $action = "create" ;
$form = new HTML_QuickForm('test', 'POST', $self);
if ($action == 'modif') {
$form->addElement('hidden', 'action', 'domodif');
}
$form->addElement('text', 'something', 'blabla:');
$form->addElement('submit', NULL, 'go');
$form->toHtml();
$form->display();
?>