Reply to Re: [PHP] optional rule quick_form

Your name:

Reply:


Posted by Uroš Gruber on 08/11/05 16:06

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация