TX Text Control provides a sophisticated way to create and deploy forms using the online editor and document viewer. Existing forms with form text fields, checkboxes, drop-downs and date picker fields can be imported from MS Word or created using TX Text Control:

Template with form fields

This form can be deployed using the TX Text Control DocumentViewer that shows the form fields automatically including conditional instructions:

Template with form fields

Convert to HTML Forms

The DocumentViewer is responsive and supports mobile devices as well, but sometimes a pure HTML form is the better option to request data from users. Specifically, if the completed data should be collected on mobile devices. The advantage of TX Text Control is the integration into a complete workflow:

  1. Maintain one master form template
  2. Extract form fields
  3. Merge data into master template
  4. Create final PDF from merged data and the template

The following illustration shows this workflow in detail:

Template with form fields

In this sample, all form fields are converted into HTML form elements. A SubTextPart TX Text Control .NET Server for ASP.NET
JavaScript API
SubTextPart Object
A SubTextPart object represents a user-defined part of a document.
object is used as a structural element to group specific form fields.

Template with form fields

Creating Form Groups

The name of the SubTextPart is then used to generate a group of form fields. The following JavaScript function shows how to convert the current selection into a SubTextPart in the document:

Loading...

On clicking Convert to HTML Form, the document is being saved and sent to the Controller method CreateForm:

Loading...

The Controller method loads the document into a ServerTextControl TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
in order to loop through all SubTextParts.

Loading...

Each section (SubTextPart) is saved and processed individually to extract the form fields:

Loading...

Create HTML Form Fields Client-Side

Finally, a list of SmartFormField objects is returned. These objects contain the required information to create the HTML form client-side:

Loading...

In the client-side JavaScript, these SmartFormField objects are converted to HTML forms and are added dynamically to the DOM:

Loading...

You can download the full sample from our GitHub repository to test this on your own.