createElement('radio', null, null, 'choice 1', 'ch1'); $radio[] = &$form->createElement('radio', null, null, 'choice 2', 'ch2'); $radio[] = &$form->createElement('radio', null, null, 'choice 3', 'ch3'); $form->addGroup($radio, 'element1', 'element 1:', '
'); $form->addElement('text', 'text1', 'only if choice 1 is selected'); $form->addElement('text', 'text2', 'only if choice 2 is selected'); $form->addElement('text', 'text3', 'only if choice 3 is selected'); $form->addElement('submit', 'btnSubmit', 'Submit'); $form->registerRule('checkDependencies','function','checkDependencies'); $form->addRule('text1','Please enter a valid input for text1', 'checkDependencies', 'ch1', 'client'); $form->addRule('text2','Please enter a valid input for text2', 'checkDependencies', 'ch2', 'client'); $form->addRule('text3','Please enter a valid input for text3', 'checkDependencies', 'ch3', 'client'); if ($form->validate()) { # If the form validates then freeze the data $form->freeze(); } $form->display(); function checkDependencies($a) { return true; } ?>