[ic] selected tag

Mark Johnson mark.johnson@akopia.com
Mon, 12 Feb 2001 10:03:31 -0500

Kaare Rasmussen wrote:
> What am I doing wrong?
> I try to have one <option> selected if it matches a preset scratch variable.
> But it doesn't work.
> [query list=1 sql="SELECT deliverycode,name FROM co_deliveryterms ORDER BY
> deliverycode"]
> [list]
>   <OPTION VALUE="[sql-param deliverycode]"
>   [selected interpolate=1 [sql-param deliverycode] [scratch deliverycode] ]>
>   [sql-param name]
>  </OPTION>
> [/list]
> [/query]

You cannot mix named and ordered parameters. And, you must quote to
force interpolation. Moreover, the interpolate directive applies to the
body of a containing tag, which doesn't apply here.

[selected name=[sql-param deliverycode] value="[scratch deliverycode]"]

[*-param...] tags do not need forced interpolation as they are parsed
prior to other tags within the block. However, it doesn't hurt and can
obviate problems with unexpected spaces.

Mark Johnson
Akopia Professional Services