Submit a specified Form.
#include <IE.au3>
_IEFormSubmit ( ByRef $o_object [, $f_wait = 1] )
Parameters
$o_object | Object variable of an InternetExplorer.Application, Form object |
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning |
Return Value
Success: | Returns -1 |
Failure: | Returns 0 and sets @ERROR |
@Error: | 0 ($_IEStatus_Success) = No Error |
1 ($_IEStatus_GeneralError) = General Error | |
3 ($_IEStatus_InvalidDataType) = Invalid Data Type | |
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type | |
6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout | |
8 ($_IEStatus_AccessIsDenied) = Access Is Denied | |
@Extended: | Contains invalid parameter number |
Remarks
For many HTML forms it is not sufficient to use _IEFormSubmit() because there is often custom JavaScript tied to an onClick event for its Submit button. In these cases you'll need to simulate a click of the submit button instead of using _IEFormSubmit(). See the example for the "click" action of _IEAction().
Related
_IEFormReset, _IEFormGetObjByName, _IEFormGetCollection, _IEFormElementGetObjByName, _IEFormElementGetCollection, _IELoadWait
Example
; *******************************************************
; Example 1 - Open a browser with the form example, fill in a form field and submit the form
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! It works!")
_IEFormSubmit ($oForm)
; *******************************************************
; Example 2 - Get a reference to a specific form element and set its value.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)