a [1] => a ) * * is quite different from the array given to the success function * * Array ( [arrname] => Array ( [time] => a [room] => a ) [save] => submit ) * */ function tester($form_data_array){ echo "tester:
"; print_r($form_data_array); echo "
"; return false; //return true; } require 'HTML/QuickForm.php'; $form = new HTML_QuickForm('test'); $arr=array(); $arr['a'] =& HTML_QuickForm::createElement('text','time',"time_"); $arr['b'] =& HTML_QuickForm::createElement('text','room',"room_"); $ret=$form->addGroup(&$arr, 'arrname','fields (must not be empty and must be equal to pass all tests):', ', '); //, NULL,NULL,FALSE $form->addGroupRule('arrname',"all fields are required",'required'); $form->addRule(array('arrname[time]','arrname[room]'), "fields don't match rule",'callback',"tester", NULL, NULL, TRUE); // uncomment this and the above comment: still doesn't work // $form->addRule(array('prereserve_time]','prereserve_room]'), // "fields don't match rule",'callback',"make_prereservation", NULL, NULL, TRUE); // or uncomment this: doesn't work with compare, either //$form->addRule(array('arrname[time]','arrname[room]'), // "fields don't match each other",'compare',NULL, NULL, NULL, TRUE); echo "
";
//print_r ($ret->getElements()); // contains the elements
echo "
"; //echo "..".($form->elementExists('arrname[time]'))."..
"; // echoes "...." if (PEAR::isError($ret)) { echo $ret->getMessage(); echo $ret->getUserInfo(); //var_dump($ret); } $form->addElement('submit','save','submit'); if ($form->validate()) { $form->process('success'); } else { $form->display(); } // Define a function to process the form data function success($v) { global $subjects; echo "success! results:
"; print_r ($v); } ?>