Live form field API
Build and inspect smart forms
Place the caret in the document, insert a Word-compatible field, and use the live model to understand how form fields remain addressable document objects.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Form fields are structured document data
TX Text Control combines visual, Word-compatible form controls with a JavaScript object model. Applications can build forms dynamically, react to user input, inspect field metadata, and navigate to fields without parsing document text.
Field collection
TXTextControl.formFields
Insertion
FormFieldCollection.addTextFormField / addSelectionFormField
Current field
FormFieldCollection.getItem
Navigation
TextField.scrollTo
How it works
TXTextControl.formFields represents the fields in the active text part. Its insertion methods create TextFormField, SelectionFormField, CheckFormField, and DateFormField objects at the current caret position.
A SelectionFormField becomes a fixed drop-down when setEditable(false) is used. With setEditable(true), the same field becomes a combo box that accepts either a configured item or custom text.
FormFieldCollection.getItem returns the form field containing the current input position. Common TextField members expose its name, ID, text range, and value, while type-specific members provide items, checked state, or date information.
The collection map combines getCount and elementAt to discover fields dynamically. Calling scrollTo on an entry moves the input position into that field and brings it into view.
TXTextControl.formFields.addSelectionFormField(1000, field => {
field.setName("ShippingMethod", () => {
field.setEditable(false, () => {
field.setItems(["Standard", "Express", "Overnight"]);
});
});
});
TXTextControl.formFields.getItem(field => {
if (!field) return;
field.getName(name => console.log(name));
field.getStart(start => console.log(start));
});
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0