RE: [PEAR] setDeaults for several radio button groups..
| From: | Ellen Sundh | Date: | Thu, 14 Oct 2004 15:46:27 +0000 |
| Subject: | RE: [PEAR] setDeaults for several radio button groups.. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14912@lists.php.net to get a copy of this message | ||
Hi again!
I solved it by changing the name of the array that parses all the different
options, for each group:
$arrName = "types$i";
${$arrName}[] =&
HTML_QuickForm::createElement('radio',null,null,'None','None');
${$arrName}[] =& HTML_QuickForm::createElement('radio',null,null,'Live
Session','Live Session');
${$arrName}[] =& HTML_QuickForm::createElement('radio',null,null,'Selected
Remix','Selected Remix');
$arr = ${$arrName};
$form->addGroup($arr,"type_$i","Type: "," ");
Ellen
-----Original Message-----
From: Ellen Sundh [mailto:ellen@digitlondon.com]
Sent: 14 October 2004 16:28
To: pear general
Subject: [PEAR] setDeaults for several radio button groups..
Hi!
I have problems with setting the default vaule for radiobuttons..
I have a set of 30 rows with radiobuttons.. each group is named type_0,
type_1..
If I just have one set of group there is no problem setting the detault
value for the radio buttons..
But as soon as there are several they are all set to the last value I feed
in to my defaultValues array..
$defaultValues = array();
for($i=0; $i<$playlist_maxItems; $i++) {
if($i == 0) {
$defaultValues["type_$i"] = "Live Session";
} else {
$defaultValues["type_$i"] = "None";
}
if(($i + 1)== $playlist_maxItems) $defaultValues["type_$i"] = "Selected
Remix";
}
$form->setDefaults($defaultValues)
I print out the array and get
Array ( [type_0] => Live Session [type_1] => None [type_2] => None [type_3]
=> None [type_4] => None [type_5] => None [type_6] =>...
But why is type_0 not set "to Live Session" in the form? It is set to
"Selected Remix".
Please let me know if there is any solution to this as I spent several days
on trying to solve this.
PS. The setDeault stuff works for all textfields I have in the same form.
Thanks in advance!
Ellen Sundh
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php