Quickform validation problem

From: Date: Tue, 20 Oct 2009 12:10:07 +0000
Subject: Quickform validation problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30097@lists.php.net to get a copy of this message
Hi folks, I'm having some trouble with the validation of a HTML_Quickform-Object. This is the code: /* Begin PHP */ $form = new HTML_QuickForm('firstForm', 'GET'); if($_GET['kunde_id'] != "") { $form->addElement('text', 'kunde_id', 'kunde_id'); } elseif($_GET['standort_id'] != "") { $form->addElement('text', 'standort_id', 'standort_id'); } elseif($_GET['objekt_id'] != "") { $form->addElement('text', 'objekt_id', 'objekt_id'); } elseif($_GET['raum_id'] != "") { $form->addElement('text', 'raum_id', 'raum_id'); } $form->addElement('text', 'vorname', 'vorname'); $form->applyFilter('vorname', 'trim'); $form->addRule('vorname', 'Bitte geben Sie den Vornamen ein!', 'required', null, 'client'); $form->addElement('text', 'nachname', 'nachname'); $form->applyFilter('nachname', 'trim'); $form->addRule('nachname', 'Bitte geben Sie den Nachnamen ein!', 'required', null, 'client'); $form->addElement('submit', null, 'Send'); if($form->validate()) { // do something exit; } else { // do nothing } $form->display(); /* End PHP */ This Page is included in a second page (start.php) that also includes 'HTML/QuickForm.php'. The code does not exactly behave like I expect it to. The client-validation itself works perfectly right. But everytime I load start.php including this page, I get a server-side-notification that 'vorname' and 'nachname' are required fields without even having looked at the 'submit'-Button. Any ideas?

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