> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/forms/forms/add-form-field-indicators.md).

# Adding form field indicators

Enhance form field usability with this guide on adding indicators to your web forms. Learn how to toggle, hide, show, and set indicators programmatically for improved user experience. The Apryse Web S

The following code adds indicator text to all the form fields after the [annotationsLoaded](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getAnnotationsLoadedPromise__anchor) promise has resolved.

{% hint style="info" %}
Note this feature is for WebViewer 8.9+
{% endhint %}

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
.then(instance => {
  const { documentViewer, annotationManager, Annotations } = instance.Core;

  const addIndicator = (widget) => {
    widget.setFieldIndicator(true, 'Insert text here');
  };

  documentViewer.addEventListener('annotationsLoaded', () => {
    const widgetAnnotations = annotationManager.getAnnotationsList().filter(annotation => annotation instanceof Annotations.WidgetAnnotation);
    widgetAnnotations.forEach(addIndicator);

    annotationManager.trigger('annotationChanged', [widgetAnnotations, 'modify', {}]);
  });
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

[Annotations.WidgetAnnotation.setFieldIndicator](https://sdk.apryse.com/api/web/Core.Annotations.WidgetAnnotation.html#setFieldIndicator__anchor) [DocumentViewer#annotationsLoaded](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#event:annotationsLoaded__anchor) [AnnotationManager#annotationChanged](https://sdk.apryse.com/api/web/Core.AnnotationManager.html#event:annotationChanged__anchor) [UI.openElements](https://sdk.apryse.com/api/web/UI.html#.openElements)

{% hint style="info" %}
Note the [annotationChanged](https://sdk.apryse.com/api/web/Core.DocumentViewer.html#getAnnotationsLoadedPromise__anchor) event is triggered afterwards so that the indicators update after the changes to the fields' widgets are made
{% endhint %}

## Toggle form field indicators

You can choose to hide form field indicators when they would normally be shown using the [hideFormFieldIndicators](https://sdk.apryse.com/api/web/UI.html#.hideFormFieldIndicators) API.

Likewise, you can also choose to show form field indicators if they have been hidden using the [showFormFieldIndicators](https://sdk.apryse.com/api/web/UI.html#.hideFormFieldIndicators) API.

## Set form field indicators programatically

You can choose to hide form field indicators when they would normally be shown or show them when they are hidden, and change the text that they contain using the [setFieldIndicator](https://sdk.apryse.com/api/web/Core.Annotations.WidgetAnnotation.html#setFieldIndicator__anchor) API.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/web/forms/forms/add-form-field-indicators.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
