> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
