Set the value of a specified form element
#include <IE.au3>
_IEFormElementRadioSelect ( ByRef $oObject, $sString, $sName [, $iSelect = 1 [, $sMode = "byValue" [, $iFireEvent = 1]]] )
$oObject | Object variable of an InternetExplorer.Application, Form object |
$sString | Value used to match element - treatment based on $sMode |
$sName | Name or Id of Radio Group |
$iSelect | [optional] specifies whether element should be selected or deselected -1 = Return selected state 0 = Unselect the element 1 = (Default) Select the element |
$sMode | [optional] specifies search mode "byValue" = (Default) value of the radio you wish to select "byIndex" = 0-based index of radio you wish to select |
$iFireEvent | [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 |
Success: | the current selected state if $iSelect = -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 |
The $iFireEvent parameter is significant only if the form element has an onChange event associated with it.
$sName 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.
_IEFormElementCheckBoxSelect, _IEFormElementGetValue, _IEFormElementOptionSelect, _IEFormElementSetValue
; 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)
; 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)