This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/ios/forms/javascript-validation.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. iOS PDF form validations using JavaScript | Nutrient SDK

Nutrient has some support for executing JavaScript attached to a document, annotations, or forms. For more general information about Nutrient’s JavaScript support, see our PDF JavaScript support guide.

Most form validation scripts should work out of the box. We’re constantly working to improve the engine and expand our coverage of the PDF specification’s support for JavaScript.

PDF JavaScript function declarations can use default parameter values. Nutrient fully recalculates form calculations that depend on other calculated fields. This happens even if the PDF’s calculation order lists dependent fields before the fields they depend on.

Supported formatting API

Nutrient supports the following functions for form formatting and validation. See Adobe’s documentation to learn more about them.

Number formatting

  • AFNumber_Format, AFNumber_Keystroke, AFMakeNumber

Percent formatting

  • AFPercent_Format, AFPercent_Keystroke

Date formatting

  • AFDate_Format, AFDate_FormatEx, AFDate_Keystroke, AFDate_KeystrokeEx, AFTime_Format, AFTime_FormatEx, AFTime_Keystroke

Special formatting

  • AFSpecial_Format, AFSpecial_Keystroke, AFSpecial_KeystrokeEx

Simple formatting

  • AFSimple, AFSimple_Calculate

Range validation

  • AFRange_Validate