Table of Contents

Interface IHtmlFormElement

Namespace
AngleSharp.Html.Dom
Assembly
AngleSharp.dll

Represents the form HTML element.

[DomName("HTMLFormElement")]
public interface IHtmlFormElement : IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IGlobalEventHandlers
Inherited Members
Extension Methods

Properties

AcceptCharset

Gets or sets the character encodings that are to be used for the submission.

[DomName("acceptCharset")]
string? AcceptCharset { get; set; }

Property Value

string

Action

Gets or sets the form's name within the forms collection.

[DomName("action")]
string Action { get; set; }

Property Value

string

Autocomplete

Gets or sets if autocomplete is turned on or off.

[DomName("autocomplete")]
string? Autocomplete { get; set; }

Property Value

string

Elements

Gets all the form controls belonging to this form element.

[DomName("elements")]
IHtmlFormControlsCollection Elements { get; }

Property Value

IHtmlFormControlsCollection

Encoding

Gets or sets the encoding to use for sending the form.

[DomName("encoding")]
string Encoding { get; set; }

Property Value

string

Enctype

Gets or sets the encoding to use for sending the form.

[DomName("enctype")]
string? Enctype { get; set; }

Property Value

string

this[int]

Gets the form element at the specified index.

[DomAccessor(Accessors.Getter)]
IElement? this[int index] { get; }

Parameters

index int

The index in the elements collection.

Property Value

IElement

The element or null.

this[string]

Gets the form element(s) with the specified name.

[DomAccessor(Accessors.Getter)]
IElement? this[string name] { get; }

Parameters

name string

The name or id of the element.

Property Value

IElement

A collection with elements, an element or null.

Length

Gets the number of elements in the Elements collection.

[DomName("length")]
int Length { get; }

Property Value

int

Method

Gets or sets the method to use for transmitting the form.

[DomName("method")]
string Method { get; set; }

Property Value

string

Name

Gets or sets the value of the name attribute.

[DomName("name")]
string? Name { get; set; }

Property Value

string

NoValidate

Gets or sets the indicator that the form is not to be validated during submission.

[DomName("noValidate")]
bool NoValidate { get; set; }

Property Value

bool

Target

Gets or sets the target name of the response to the request.

[DomName("target")]
string Target { get; set; }

Property Value

string

Methods

CheckValidity()

Checks if the form is valid, i.e. if all fields fulfill their requirements.

[DomName("checkValidity")]
bool CheckValidity()

Returns

bool

True if the form is valid, otherwise false.

GetSubmission()

Creates the document request from the form submitting itself.

DocumentRequest? GetSubmission()

Returns

DocumentRequest

The resulting document (e.g., HTTP) request.

GetSubmission(IHtmlElement)

Creates the document request from the form by submitting by some element.

DocumentRequest? GetSubmission(IHtmlElement sourceElement)

Parameters

sourceElement IHtmlElement

The form's submitter.

Returns

DocumentRequest

The resulting document (e.g., HTTP) request.

ReportValidity()

Reports the current validity state after checking the current state interactively the constraints of the form element.

[DomName("reportValidity")]
bool ReportValidity()

Returns

bool

True if the form element is valid, otherwise false.

RequestAutocomplete()

Requests the input fields to be automatically filled with previous entries.

[DomName("requestAutocomplete")]
void RequestAutocomplete()

Reset()

Resets the form to the previous (default) state.

[DomName("reset")]
void Reset()

SubmitAsync()

Submits the form element from the form element itself.

[DomName("submit")]
Task<IDocument> SubmitAsync()

Returns

Task<IDocument>

SubmitAsync(IHtmlElement)

Submits the form element as triggered from another element.

Task<IDocument> SubmitAsync(IHtmlElement sourceElement)

Parameters

sourceElement IHtmlElement

The form's submitter.

Returns

Task<IDocument>