[PEAR][HTML_QuickForm] Select et valeur par défaut
bonjour,
j'utilise quickform avec smarty.
j'ai un champ select
Code:
1 2 3 4
|
$selectsection = & $form->addElement('select', 'ID_Section', 'N° section : ') ;
$selectsection->load($result) ;
$selectsection->loadQuery($dsn,'select * from section ','ID_Section','ID'); |
comment faire pour avoir la variable $toto comme valeur par defaut affichée ?
dans le style
Code:
1 2 3 4 5 6
|
<SELECT name="section" size="1">
<OPTION value="a">a</OPTION>
<OPTION selected value=b">b</OPTION>
...
</SELECT> |
où $toto = "b"
d'avance merci
Philippe
Re: quickform select et valeur par defaut
Salut,
moi j'ai utilisé selected="selected" dans ma liste quand c'est selectionné. exemple :
Code:
1 2 3 4 5 6
|
<SELECT name="section" size="1">
<OPTION value="a" <php if($toto=='a'){echo 'selected="selected"';} ?>>a</OPTION>
<OPTION value="b" <php if($toto=='b'){echo 'selected="selected"';} ?>>b</OPTION>
...
</SELECT> |
je ne sais pas si ca repond à ta question :)
Re: quickform select et valeur par defaut
bonjour,
mais non. je cherche à utiliser quickform et donc dans addelement ou addrule il doit y avoir moyen d'indiquer la valeur par defaut.
Merci quand même
Philippe