Re: Quickform issues

From: Date: Thu, 16 Jan 2003 09:32:17 +0000
Subject: Re: Quickform issues
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3319@lists.php.net to get a copy of this message
<john.f.kline@att.net> wrote : > Bertrand, > > I need to have the following functionality supported in Quickforms 2.1.5: > > 1) Having a group of radio buttons with no default value set but with a > required rule set. For example, a 'yes' or 'no' question or a mandatory > quality question like: Rate PHP: () superior () average () unacceptable.. I > do not want to start with a default value BUT I want to require that a radio > button is selected. > > The following code sniblet does not work: > $radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', > 'Y'); > $radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No', > 'N'); > $form->addElementGroup($radio, 'Yes/No:', 'iradYesNo'); > $form->addGroupRule('iradYesNo', "question is required.", > 'required','',0); // > regardless of '1' or '0') > > > One thing I do notice is that a warning is thrown on QuickForm.php line 1563 > because this radio group is a single value and NOT an array. I can not find > in the code where the decision is made that checkboxes are stored in arrays > and radios as single values? Any hints? > > > 2) An alternative to the above would be having a rule for checkboxes such > that one and only one box is selected. Can this be done? It does not appear > to work. Hi John, I am very busy right now so I won't be able to look at your problem before the end of next week. Did you try with the element HTML_QuickForm_advcheckbox ? I don't think your problem is too difficult to solve, I just don't have the time now (I deliver something for a client too). Bertrand Mansion Mamasam

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