|
ION Script User's Guide: ION Script Tag Reference |
|
An ION_RADIO button is similar to an HTML radio button created with <INPUT TYPE="RADIO">. ION_RADIO allows you to maintain the selection state of a radio button group when reloading the page.
<ION_RADIO
NAME="group name"
VALUE="value"
[DEFAULT]
[<INPUT TYPE="RADIO"> attributes] />
Include this attribute to cause this radio button to be the button that is initially selected when the page loads for the first time. Only one button in a group can include this attribute.
The name of the radio button group. Each radio button in a group uses the same NAME. This name is used to refer to the value of the selected radio button using the format $Form.NAME. This attribute can contain a variable. The NAME you specify for form fields cannot begin with ION_ _.
The value assigned to the radio button, which can be accessed using $Form.NAME. If this value is numeric, and you want to use it in an expression, you must declare a new INT or DOUBLE variable, assign it the value $Form.NAME, and use the new variable in the expression instead of $Form.NAME. See Using $Form Variables in Numeric Expressions. This attribute can contain a variable.
| Note All attributes of the HTML <INPUT TYPE="RADIO"> are also available to ION_RADIO. See INPUT. |
The ION_RADIO tag is converted to the HTML <INPUT TYPE="radio"> tag. The NAME and VALUE attributes of the ION_RADIO tag become the NAME and VALUE attributes of the <INPUT> tag. If DEFAULT is specified, it becomes the CHECKED attribute of the <INPUT TYPE="radio"> tag. All attributes of the HTML <INPUT> tag are also available to ION_RADIO.
In this example, we create a group of radio buttons, and a button with an EVENT that reloads the page. When the user clicks the button, the name of the selected button is written to the page. Note the following in this example:
<ION_SCRIPT> <ION_HEADER> <EVENTS> <EVENT_DECL NAME="RELOAD" ACTION="ion://radio.ion" /> </EVENTS> </ION_HEADER> <ION_BODY> <ION_FORM> <ION_RADIO NAME="Group1" VALUE="1"/> Button 1<BR> <ION_RADIO NAME="Group1" VALUE="2" DEFAULT/> Button 2<BR> <ION_RADIO NAME="Group1" VALUE="3"/> Button 3<BR> <ION_BUTTON EVENT="RELOAD" LABEL="SUBMIT" TYPE="BUTTON"/><BR> </ION_FORM> <ION_IF EXPR="NOT ($Form.Group1 ISTYPE 'UNDEF')"> <B>Button <ION_VARIABLE NAME="$Form.Group1"/> was selected</B> </ION_IF> </ION_BODY> </ION_SCRIPT>
The following figure shows the result of this example:
IDL Online Help (March 06, 2007)