Class FormEditor

Class FormEditor

Namespace: Aspose.Html.Forms
Assembly: Aspose.HTML.dll (25.2.0)

This class represents the editor over the Aspose.Html.HTMLFormElement that creates a easier way for .net developers to edit the html forms.

[ComVisible(true)]
public class FormEditor : IEnumerable<formelement>, IEnumerable, IDisposable

Inheritance

objectFormEditor

Implements

IEnumerable<formelement>, IEnumerable, IDisposable

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

Action

Server-side form handler. See the action attribute definition in HTML 4.01.

public string Action { get; set; }

Property Value

string

Count

The number of form controls in the form.

public int Count { get; }

Property Value

int

Form

The original Aspose.Html.HTMLFormElement that is associated with current instance of Aspose.Html.Forms.FormEditor.

public HTMLFormElement Form { get; }

Property Value

HTMLFormElement

Method

HTTP method [IETF RFC 2616] used to submit form. See the method attribute definition in HTML 4.01.

public HttpMethod Method { get; set; }

Property Value

HttpMethod

this[int]

Returns the element by specified index.

public FormElement this[int index] { get; }

Property Value

FormElement

this[string]

Returns the element by specified name or id.

public FormElement this[string name] { get; }

Property Value

FormElement

Methods

Add<t>(string)

Creates a new Aspose.Html.HTMLElement and adds it to the end of the form.

public T Add<t>(string name) where T : FormElement

Parameters

name string

Name of the element

Returns

T

A new instance of form element

Type Parameters

T

Type of form element

AddInput(string)

Creates a new Aspose.Html.Forms.InputElement and adds it to the end of the form.

public InputElement AddInput(string name)

Parameters

name string

Name of input element

Returns

InputElement

Returns a new created Aspose.Html.Forms.InputElement.

AddInput(string, InputElementType)

Creates a new Aspose.Html.Forms.InputElement and adds it to the end of the form.

public InputElement AddInput(string name, InputElementType type)

Parameters

name string

Name of input element

type InputElementType

Type of input element

Returns

InputElement

Returns a new created Aspose.Html.Forms.InputElement.

Create(HTMLFormElement)

Creates a new Aspose.Html.Forms.FormEditor based on Aspose.Html.HTMLFormElement.

public static FormEditor Create(HTMLFormElement form)

Parameters

form HTMLFormElement

The html form element

Returns

FormEditor

Return a new instance of the Aspose.Html.Forms.FormEditor class

Create(HTMLDocument, int)

Creates a new Aspose.Html.Forms.FormEditor based on Aspose.Html.HTMLFormElement selected from the Aspose.Html.HTMLDocument.Forms collection by index.

public static FormEditor Create(HTMLDocument document, int index)

Parameters

document HTMLDocument

The document.

index int

The index inside the forms collection.

Returns

FormEditor

Return a new instance of the Aspose.Html.Forms.FormEditor class

Exceptions

DOMException

The exception is occured if index out of the range.

Create(HTMLDocument, string)

Creates a new Aspose.Html.Forms.FormEditor based on Aspose.Html.HTMLFormElement selected from the document by id.

public static FormEditor Create(HTMLDocument document, string id)

Parameters

document HTMLDocument

The document.

id string

The identifier.

Returns

FormEditor

Return a new instance of the Aspose.Html.Forms.FormEditor class

Exceptions

DOMException

The exception is occured if there is no element by specified Id or element is not a form type.

CreateNew(HTMLDocument)

Creates a new Aspose.Html.HTMLFormElement and associated it with Aspose.Html.Forms.FormEditor. Aspose.Html.HTMLFormElement is created in the detached from the document state; in order to attach it to the document, please select proper location and use Aspose.Html.Dom.Node.AppendChild(Aspose.Html.Dom.Node) method.

public static FormEditor CreateNew(HTMLDocument document)

Parameters

document HTMLDocument

The Aspose.Html.HTMLDocument.

Returns

FormEditor

Return a new instance of the Aspose.Html.Forms.FormEditor class

Dispose()

Releases unmanaged and managed resources.

public void Dispose()

Fill(Dictionary<string, string="">)

This method fills the whole form with the specified values.

public void Fill(Dictionary<string, string=""> values)

Parameters

values Dictionary<string, string&gt;

The values represented by key-value pair that is contains name and value for form elements.

GetElement<t>(int)

Returns the element by specified index.

public T GetElement<t>(int index) where T : FormElement

Parameters

index int

The index of the element

Returns

T

Returns the element.

Type Parameters

T

Type of the form element

GetElement<t>(string)

Returns the element by specified name.

public T GetElement<t>(string name) where T : FormElement

Parameters

name string

The element name

Returns

T

Returns the element.

Type Parameters

T

Type of the form element

GetEnumerator()

Gets the enumerator.

public IEnumerator<formelement> GetEnumerator()

Returns

IEnumerator<FormElement&gt;

Returns the FormElements enumerator. </t></t></string,></string,></t></formelement>