Table of Contents

Class FormExtensions

Namespace
AngleSharp.Html.Dom
Assembly
AngleSharp.dll

A set of useful extension methods when dealing with the DOM.

public static class FormExtensions
Inheritance
FormExtensions
Inherited Members

Methods

SetValues(IHtmlFormElement, IDictionary<string, string>, bool)

Set the field values of given form by using the dictionary which contains name value pairs of input fields.

public static IHtmlFormElement SetValues(this IHtmlFormElement form, IDictionary<string, string> fields, bool createMissing = false)

Parameters

form IHtmlFormElement

The form to set.

fields IDictionary<string, string>

The fields to use as values.

createMissing bool

What to do if some field(s) have not been found in the form. If true, then new input will be created. Otherwise, an exception will be thrown.

Returns

IHtmlFormElement

The given form for chaining.

SubmitAsync(IHtmlElement, IDictionary<string, string>, bool)

Submits the form of the element by using the dictionary which contains name value pairs of input fields to submit.

public static Task<IDocument> SubmitAsync(this IHtmlElement element, IDictionary<string, string> fields, bool createMissing = false)

Parameters

element IHtmlElement

The element to submit its form.

fields IDictionary<string, string>

The fields to use as values.

createMissing bool

What to do if some field(s) have not been found in the form. If true, then new input will be created. Otherwise, an exception will be thrown.

Returns

Task<IDocument>

The task eventually resulting in the response.

SubmitAsync(IHtmlElement, object?)

Submits the form of the element by decomposing the object into a dictionary that contains its properties as name value pairs.

public static Task<IDocument> SubmitAsync(this IHtmlElement element, object? fields = null)

Parameters

element IHtmlElement

The element to submit its form.

fields object

The optional fields to use as values.

Returns

Task<IDocument>

The task eventually resulting in the response.

SubmitAsync(IHtmlFormElement, IDictionary<string, string>, bool)

Submits the given form by using the dictionary which contains name value pairs of input fields to submit.

public static Task<IDocument> SubmitAsync(this IHtmlFormElement form, IDictionary<string, string> fields, bool createMissing = false)

Parameters

form IHtmlFormElement

The form to submit.

fields IDictionary<string, string>

The fields to use as values.

createMissing bool

What to do if some field(s) have not been found in the form. If true, then new input will be created. Otherwise, an exception will be thrown.

Returns

Task<IDocument>

The task eventually resulting in the response.

SubmitAsync(IHtmlFormElement, object)

Submits the given form by decomposing the object into a dictionary that contains its properties as name value pairs.

public static Task<IDocument> SubmitAsync(this IHtmlFormElement form, object fields)

Parameters

form IHtmlFormElement

The form to submit.

fields object

The fields to use as values.

Returns

Task<IDocument>

The task eventually resulting in the response.