Re: QF: set values for select in another file

From: Date: Mon, 27 Oct 2003 09:40:55 +0000
Subject: Re: QF: set values for select in another file
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8605@lists.php.net to get a copy of this message
Alexey Borzov wrote: > Hi! > > morten@therkildsen.dk wrote: >> Im using a config-file, for setting up values to an QucikForm. > > How cool! > >> I have problems setting the values for an select-box. > > How unfortunate! > >> config.php: >> ======= >> $cfg->Niveau['labelText'] ="Text to show for the user"; >> $cfg->Niveau['selectText'] = ""; //what to write here??? > > Have you tried looking at the examples and/or reading the docs? Yes.. I have. Both things, but have found nothing. On the other hand, I have found a solution on my own. It is maybe not very clever, but it works. Wounder if there is another (better way) ??? I dont understand how these works: ==================== HTML_QuickForm_select::addOption('test', 'text'); HTML_QuickForm_element::setValue($cfg->Niveau['selectText']); Here goes my hack: config.php: ====== $cfg->Niveau['labelText'] ="Select your linuxniveau"; // Level of linux exp. $cfg->Niveau['selectText'] = "Newbie .. Never seen linux before, Been using it for a year now, Linux is my only OS"; QuickForm.php: ========= $arraySelectText = explode (",", $cfg->Niveau['selectText']);; while(list($key, $value) = each ($arraySelectText)) { $selectText[] = $value; } $form->addElement('select', 'linuxniveau', $cfg->Niveau['labelText'], $selectText); Morten Therkildsen -- Danish http://linuxparty.dk - a place for linuxusers to meet over an weekend.

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