Accessibility Compliance
SurveyJS libraries meet a variety of WCAG and Section 508 standards. Run AXE® Validation to assess this demo’s accessibility level.

Detect Abbreviations in Form Entries

Edit in →

Abbreviation detection recognizes shortened forms, acronyms, and shorthand in entered text, then expands them, suggests a full term, or flags ambiguous usage. Examples include BP → Blood Pressure, NYC → New York City, and MS, which can have multiple meanings in clinical settings.

To detect abbreviations in SurveyJS, register a custom asynchronous function and add async expression validators to a question's validators array. You can also expand recognized abbreviations in the onValueChanged event handler.

How This Demo Works

  1. An in-demo terminology dictionary simulates a reference data source.
  2. Common department abbreviations expand automatically (for example, HR becomes Human Resources).
  3. Other fields use async expression validators that call the isAbbreviationAcceptable function.
  4. If an abbreviation issue is detected, the function returns false, and the field displays the validator text.

In this demo, validators use "notificationType": "warning", so validation messages do not block form submission. To prevent the form from being submitted until the issue is resolved, use the default "error" notification type.

Validator Notification Types

Connect to an API Endpoint

To validate against a terminology service, dictionary, or natural language processing (NLP) endpoint, replace the demo helper with a fetch call (or an equivalent call using your SDK). Keep the same registerFunction and expression validator:

function isAbbreviationAcceptable([fieldName, value]) {
  if (!value) {
    this.returnResult(true);
    return;
  }
  fetch("/api/validation/abbreviations", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ fieldName, value })
  })
    .then((response) => response.json())
    .then((data) => {
      // data.ok === true means the value is acceptable
      this.returnResult(!!data.ok);
    })
    .catch(() => {
      this.returnResult(false);
    });
}

registerFunction({
  name: "isAbbreviationAcceptable",
  func: isAbbreviationAcceptable,
  isAsync: true
});

Add expression validators to your survey JSON, for example: "expression": "isAbbreviationAcceptable('location', {location})". Refer to the JSON schema in the Code tab for more examples.

Your cookie settings

We use cookies to make your browsing experience more convenient and personal. Some cookies are essential, while others help us analyse traffic. Your personal data and cookies may be used for ad personalization. By clicking “Accept All”, you consent to the use of all cookies as described in our Terms of Use and Privacy Statement. You can manage your preferences in “Cookie settings.”

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.