### Signal

# WebKit2WebExtension WebPage::will-submit-form

#### Declaration

    void
    will_submit_form (
      WebKitWebPage* self,
      WebKitDOMElement* form,
      WebKit2WebExtensionFormSubmissionStep* step,
      WebKitFrame* source_frame,
      WebKitFrame* target_frame,
      char** text_field_names,
      char** text_field_values,
      gpointer user_data
    )

#### Description [src]

This signal is emitted to indicate various points during form submission. `step` indicates the current stage of form submission.

If this signal is emitted with `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT`, then the DOM submit event is about to be emitted. JavaScript code may rely on the submit event to detect that the user has clicked on a submit button, and to possibly cancel the form submission before `WEBKIT_FORM_SUBMISSION_WILL_COMPLETE`. However, beware that, for historical reasons, the submit event is not emitted at all if the form submission is triggered by JavaScript. For these reasons, `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT` may not be used to reliably detect whether a form will be submitted. Instead, use it to detect if a user has clicked on a form’s submit button even if JavaScript later cancels the form submission, or to read the values of the form’s fields even if JavaScript later clears certain fields before submitting. This may be needed, for example, to implement a robust browser password manager, as some misguided websites may use such techniques to attempt to thwart password managers.

If this signal is emitted with `WEBKIT_FORM_SUBMISSION_WILL_COMPLETE`, the form will imminently be submitted. It can no longer be cancelled. This event always occurs immediately before a form is submitted to its target, so use this event to reliably detect when a form is submitted. This event occurs after `WEBKIT_FORM_SUBMISSION_WILL_SEND_DOM_EVENT` if that event is emitted.

Default handler: | The default handler is called after the handlers added via `g_signal_connect()`.
Available since: | 2.20

#### Parameters

`form` | `WebKitDOMElement`
| The `WebKitDOMElement` to be submitted, which will always correspond to an HTMLFormElement.
| The data is owned by the caller of the function.
`step` | `WebKitFormSubmissionStep`
| A `WebKitFormSubmissionEventType` indicating the current stage of form submission.
| The data is owned by the caller of the function.
`source_frame` | `WebKitFrame`
| The `WebKitFrame` containing the form to be submitted.
| The data is owned by the caller of the function.
`target_frame` | `WebKitFrame`
| The `WebKitFrame` containing the form’s target, which may be the same as `source_frame` if no target was specified.
| The data is owned by the caller of the function.
`text_field_names` | An array of `utf8`
| Names of the form’s text fields.
| The data is owned by the caller of the function.
| Each element is a NUL terminated UTF-8 string.
`text_field_values` | An array of `utf8`
| Values of the form’s text fields.
| The data is owned by the caller of the function.
| Each element is a NUL terminated UTF-8 string.