QuickForms AddGroupRule

From: Date: Thu, 01 Apr 2004 11:47:27 +0000
Subject: QuickForms AddGroupRule
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11567@lists.php.net to get a copy of this message
Greetings! Have a quetion about QuickForms -> I want to check if two values in one group are not the same, i understand that i have to write my own function for this. How values to a function transforms? And how i can check that function is registered? $form = new HTML_QuickForm('Master times'); $y=5; $x="00"; while ($y<22){ $timex[$z]=$y . ":" . $x; if ($x=="30"){$y=$y+1;$x="00";} else {$x="30";} $z++; } function notequal($fields, $values) { if ($fields['stime'] == $fields['etime']) { return false; } else { return true;} } $form->registerRule ('noteq', 'function', 'notequal'); $TimeEx['stime'] = &HTML_QuickForm::createElement('select', 'stime' , '', $timex); $TimeEx['etime'] = &HTML_QuickForm::createElement('select', 'etime' , '', $timex); $Butt[] = &HTML_QuickForm::createElement('submit','null', 'Enter'); $Butt[] = &HTML_QuickForm::createElement('reset','null', 'Reset'); $form->addElement('header', null, 'Time table'); $form->addElement('static', 'logname', "Greetings", $row[0]); $form->addGroup($TimeEx, null , "from" ," to " ); $form->addGroup($Butt, null, null, '&nbsp;'); $form->applyFilter('__ALL__', 'trim'); $form->addGroupRule('TimeEx','Enter times!', 'noteq'); if ($form->validate()) { echo '<h1>Thanks, ' . $row[0] . '!</h1>Times was inserted in to DB<br>'; } // Output the form $form->display();

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