↑  ←  Описание функции


_IEFormSubmit

Submit a specified Form.

#include <IE.au3>
_IEFormSubmit(ByRef $o_object [, $f_wait = 1])

Параметры

$o_object Переменная объекта InternetExplorer.Application, Form object
$f_wait [необязательный] Указывает, ожидать ли загрузки страницы
0 = Возвратиться немедленно, не ожидая загрузки страницы
1 = (по умолчанию) Ожидать завершения загрузки страницы перед возвратом

Возвращаемое значение

Успех:Возвращает -1
Ошибка:Возвращает 0 и устанавливает @error
@error:0 ($_IEStatus_Success) = Нет ошибок
1 ($_IEStatus_GeneralError) = Общая ошибка
3 ($_IEStatus_InvalidDataType) = Неверный тип данных
4 ($_IEStatus_InvalidObjectType) = Неверный тип объекта
6 ($_IEStatus_LoadWaitTimeout) = Тайм-аут ожидания загрузки
8 ($_IEStatus_AccessIsDenied) = Отказано в доступе
9 ($_IEStatus_ClientDisconnected) = Клиент отключен
@extended:Содержит номер неверного параметра

Примечания

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().
As well, some form processing relies on the "value" of the submit button being passed along with the rest of the form data (often when there is more than one submit button in the form and they are designed to trigger different results). This function will not result in a submit button value being passed. The solution is to use the "click" action of _IEAction() as above.
If you experience trouble with the automatic _IELoadWait called by default, please set $f_wait parameter to 0 and call _IELoadWait from your script, passing it the InternetExplorer object.

См. также

_IEFormReset, _IEFormGetObjByName, _IEFormGetCollection, _IEFormElementGetObjByName, _IEFormElementGetCollection, _IELoadWait

Пример

; *******************************************************
; Пример 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)

; *******************************************************
; Пример 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)

; *******************************************************
; Пример 3 - Get a reference to a specific form element and set its value.
;               Call _IELoadWait manually if the default _IELoadWait experiences trouble.
; *******************************************************

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm, 0)
_IELoadWait($oIE)