RE:[htmltmpl] Select/option How to set "selected"?
Brought to you by:
samtregar
From: Zheng (G. F. <zf...@ha...> - 2004-05-03 21:16:26
|
Try this: <TMPL_LOOP NAME=3DOCCUPATION_LOOP>=20 <option value=3D"<TMPL_VAR NAME=3DVAL>" <TMPL_VAR NAME=3D"SELECTED">><T= MPL_VAR NAME=3DTEXT></option>=20 </TMPL_LOOP> where the value of SELECTED is either 0 or 1 dependends o= n whether that item is selected=2E This should work for multiple select= options too=2E Zheng=20 --Original Message-- From: Mark Fuller<mark=2Efuller@earthlink=2Enet> T= o: <html-template-users@lists=2Esourceforge=2Enet>=20 Subject: [htmltmpl] Select/option How to set "selected"?=20 I am creating a select list where all the "option" content comes from= a=20 mySQL table=2E The following works fine:=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 Occupation: <select name=3D"occupation">=20 <TMPL_LOOP NAME=3DOCCUPATION_LOOP>=20 <option value=3D"<TMPL_VAR NAME=3DVAL>"><TMPL_VAR NAME=3DTEXT></option>= =20 </TMPL_LOOP>=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 How can I specify a row should be "selected"? The TMPL_VAR named "VAL" = is a=20 numeric index=2E If I could use TMPL_IF and concatenate the value of "V= AL", I=20 think it would work=2E=20 <TMPL_IF NAME=3D"SEL"<TMPL_VAR NAME=3D"VAL">>=20 selected=20 </TMPL_IF>=20 In my program I could set "$sel5 =3D 1"=2E=20 Is there any way to do this?=20 Thanks,=20 Mark=20 -------------------------------------------------------=20 This SF=2ENet email is sponsored by: Oracle 10g=20 Get certified on the hottest thing ever to hit the market=2E=2E=2E Orac= le 10g=2E=20 Take an Oracle 10g class now, and we'll give you the exam FREE=2E=20 http://ads=2Eosdn=2Ecom/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick=20 _______________________________________________=20 Html-template-users mailing list=20 Html-template- users@lists=2Esourceforge=2Enet=20 https://lists=2Esourceforge=2Enet/lists/listinfo/html-template-users=20 |