1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<!doctype html public "-//W30//DTD W3 HTML 2.0//EN">
<HTML>
<!-- This file was generated using SDF 2.001 by
Ian Clatworthy (ianc@mincom.com). SDF is freely
available from http://www.mincom.com/mtr/sdf. -->
<HEAD>
<TITLE>Template Guide: Checks and Selections</TITLE>
</HEAD>
<BODY BGCOLOR="ffffff" LINK="993333">
<DIV CLASS="header">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="ictemplates_31.html">Parent Topic</A> | <A HREF="ictemplates_34.html">Previous Topic</A> | <A HREF="ictemplates_36.html">Next Topic</A> <BR><A HREF="../index.html" TARGET="_top">Catalog</A></P>
</DIV>
</DIV>
<DIV CLASS="main">
<H2>8.4. Checks and Selections</H2>
<P>A "memory" for drop-down menus, radio buttons, and checkboxes can be provided with the <TT>[checked]</TT> and <TT>[selected]</TT> tags.</P>
<P><B>[checked var_name value]</B></P>
<UL>
named attributes: <TT>[checked name="var_name" value="value" cgi=0|1 multiple=0|1 default=0|1 case=0|1]</TT>
<BR>
This will output CHECKED if the variable <TT>var_name</TT> is equal to <TT>value</TT>. Set the <TT>cgi</TT> attribute to use cgi instead of values data. Not case sensitive unless <TT>case</TT> is set.
<BR>
If the <TT>multiple</TT> attribute is defined and set to a non-zero value (1 is implicit) and if the value matches on a word/non-word boundary, it will be CHECKED. If the <TT>default</TT> attribute is set to a non-zero value, the box will be checked if the variable <TT>var_name</TT> is empty or zero.</UL>
<P><B>[selected var_name value]</B></P>
<UL>
named attributes: <TT>[selected name="var_name" value="value" cgi=0|1 multiple=0|1 default=0|1 case=0|1]</TT>
<BR>
This will output SELECTED if the variable <TT>var_name</TT> is equal to <TT>value</TT>. Set the <TT>cgi</TT> attribute to use cgi instead of values data. Not case sensitive unless <TT>case</TT> is set.
<BR>
If the <TT>multiple</TT> argument is present, it will look for any of a variety of values. If the <TT>default</TT> attribute is set, SELECT will be output if the variable is empty or zero. Not case sensitive unless <TT>case</TT> is set.
<BR>
Here is a drop-down menu that remembers an item-modifier color selection:</UL>
<PRE>
<SELECT NAME="color">
<OPTION [selected name=color value=blue]> Blue
<OPTION [selected name=color value=green]> Green
<OPTION [selected name=color value=red]> Red
</SELECT>
</PRE>
<UL>
For databases or large lists of items, sometimes it is easier to use <TT>[loop list="foo bar"]</TT> and its <TT>option</TT> parameter. The above can be achieved with:</UL>
<PRE>
<SELECT NAME=color>
[loop list="Blue Green Red" option=color]
<OPTION> [loop-code]
[/loop]
</SELECT>
</PRE>
</DIV>
<DIV CLASS="footer">
<DIV CLASS="navigate">
<P ALIGN="Center"><A HREF="ictemplates_31.html">Parent Topic</A> | <A HREF="ictemplates_34.html">Previous Topic</A> | <A HREF="ictemplates_36.html">Next Topic</A> <BR><A HREF="../index.html" TARGET="_top">Catalog</A></P>
</DIV>
</DIV>
</BODY>
</HTML>
|