Version X18 (28.0) is shipped with a complete new JavaScript API to program the online document editor that comes with TX Text Control .NET Server for ASP.NET.

The complete JavaScript API documentation can be found in our online docs:

JavaScript API

This article describes typical tasks for inserting and processing form fields such as check boxes, drop-down boxes and form text fields.

Adding Form Text Fields

Form text fields can be used to retrieve textual content from users. A form text field has a default empty width (first parameter in the addTextFormField TX Text Control .NET Server for ASP.NET
JavaScript API
FormFieldCollection Object
addTextFormField Method
Adds a new TextFormField.
method) and it is auto-extending.

Loading...

The getCanAdd TX Text Control .NET Server for ASP.NET
JavaScript API
TextFieldCollectionBase Object
getCanAdd Method
Gets a value indicating whether a new text field can be inserted at the current input position.
method should be used for all fields inherited from TextField TX Text Control .NET Server for ASP.NET
JavaScript API
TextField Object
Represents a text field in a document.
. It returns true, if the field can be added at the current input position. A text field (or form fields) cannot be nested and therefore they cannot be inserted at positions that already contain a field. The addtextformfield method returns the field itself in the callback and can be directly used to set additional properties such as the name TX Text Control .NET Server for ASP.NET
JavaScript API
TXTextControl.TextField Object
name Property
Deprecated.
property that is defined using the setName TX Text Control .NET Server for ASP.NET
JavaScript API
TextField Object
setName Method
Sets the name of a text field.
method.

Get Form Field By Name

While the getItem TX Text Control .NET Server for ASP.NET
JavaScript API
FormFieldCollection Object
getItem Method
Gets the form field at the current text input position or the form field with the specified id.
method returns a field at the current input position or based on a given ID, the forEach TX Text Control .NET Server for ASP.NET
JavaScript API
Collection Object
forEach Method
Executes a callback function for each element.
method can be used to iterate through all elements of form field collections.

The following asynchronous function loops through all form fields and checks for the name property. If found, the Promise is resolved by returning the form field itself.

Loading...

This function needs to be called from an async function with the await operator to wait for the response.

Inserting Check Form Fields

Analogically with form text fields, check boxes can be added using the addCheckFormField TX Text Control .NET Server for ASP.NET
JavaScript API
FormFieldCollection Object
addCheckFormField Method
Adds a new CheckFormField.
method.

Loading...

Getting Form Fields at the Input Position

In order to get the field at the current input position, the getItem TX Text Control .NET Server for ASP.NET
JavaScript API
FormFieldCollection Object
getItem Method
Gets the form field at the current text input position or the form field with the specified id.
method can be used. The following code snippet shows how to change the state of a check form field when the field retrieves the input position. Usually, a check box is first activated and then checked and therefore requires two clicks initially to change the state of the check box.

Loading...

Adding Selection Form Fields

The following code shows how to insert a non-editable selection form field with pre-defined items. The setSelectedIndex TX Text Control .NET Server for ASP.NET
JavaScript API
SelectionFormField Object
setSelectedIndex Method
Sets the index of the selected item of the SelectionFormField.
method pre-selects a specific item in the list of items.

Loading...

Test this on your own using all document editor versions including Angular, Node.js, MVC and Web Forms that all share the same JavaScript API.