Function Reference


_IEFormElementRadioSelect

Set the value of a specified form element.

 #include <IE.au3>
_IEFormElementRadioSelect ( ByRef $o_object, $s_string , $s_name [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

Parameters

$o_object Object variable of an InternetExplorer.Application, Form object
$s_string Value used to match element - treatment based on $s_mode
$s_name Name or Id of Radio Group
$f_select [optional] specifies whether element should be selected or deselected
    -1 = Return selected state
    0 = Unselect the element
    1 = (Default) Select the element
$s_mode [optional] specifies search mode
    "byValue" = (Default) value of the radio you wish to select
    "byIndex" = 0-based index of radio you wish to select
$f_fireEvent [optional] specifies whether to fire OnChange and OnClick events after changing value
    0 = do not fire OnChange or OnClick event after setting value
    1 = (Default) fire OnChange and OnClick events after setting value

Return Value

Success: the current selected state if $f_select = -1, else returns 1.
Failure: 0 and sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
4 ($_IEStatus_InvalidObjectType) - Invalid Object Type
5 ($_IEStatus_InvalidValue) - Invalid Value
7 ($_IEStatus_NoMatch) - No Match
@extended: Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_name is a mandatory parameter for this function.
Radio buttons are operated upon in groups sharing the same name.
No more than one element within a group may be selected at a given time - when one item is selected, all others are deselected.

Related

_IEFormElementOptionSelect, _IEFormElementCheckBoxSelect, _IEFormElementGetValue, _IEFormElementSetValue

Example

Example 1

; Open a browser with the form example, get reference to form, select
; each radio button byValue, then deselect the last item leaving none selected.

#include <IE.au3>

Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
_IEAction($oForm, "focus")
For $i = 1 To 3
    _IEFormElementRadioSelect($oForm, "vehicleAirplane", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, "vehicleTrain", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, "vehicleBoat", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, "vehicleCar", "radioExample", 1, "byValue")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, "vehicleCar", "radioExample", 0, "byValue")
    Sleep(1000)
Next

_IEQuit($oIE)

Example 2

; Open a browser with the form example, get reference to form, select
; each radio button byIndex, then deselect the last item leaving none selected.
; Note: You will likely need to scroll down on the page to see the changes

#include <IE.au3>

Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
For $i = 1 To 3
    _IEFormElementRadioSelect($oForm, 3, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, 2, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, 1, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, 0, "radioExample", 1, "byIndex")
    Sleep(1000)
    _IEFormElementRadioSelect($oForm, 0, "radioExample", 0, "byIndex")
    Sleep(1000)
Next

_IEQuit($oIE)