Torgny Bjers said the following on 11.8.2005 14:44:
I am assuming that this is after a post operation. If it's JavaScript, I
think the question should be directed to another list. So, if you group
the elements that should be validated after the checkbox has been
checked, you can activate/deactivate the group validation rules based on
the state of the checkbox. Makes sense?
If I understand your idea the code would look like this
$form->addElement('text', 'taxNumber', 'Tax:');
$checkbox = &HTML_QuickForm::createElement('checkbox', 'isCompany','');
if ($checkbox->getChecked()) {
$form->addRule('taxNumber','required','Tax number is required');
}
if ($form->validate()) {
....
Btw yes it must be checked when user submit this. But If it's possible
client option on rule, would be better.
regards
I have one checkbox. I checkbox is checked I show additional fields
(just set visiblity to true). But some of that fields are required
only if this checkbox is checked. Is this possible with quick_form. I
try myself with grouping but without any luck.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php