• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Required field check, best place to put js in validate or calculate? Or other options

New Here ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard



I'm putting in some javascript (still new to Javascript as well) on a new interactive pdf form that requires certain fields to be filled in. Currently, I've tested having this javascript code placed within the Validate > Run custom validation script and Calculate > Custom calculate script:

var fieldName = event.targetName

f = getField (event.target.name)

if (f.value.length == 0 || !f.value.replace(/\s/g, '').length){


    app.alert(fieldName +" field is required. Please enter a value.")



Each has their own problem. Validate will only alert if something is entered in, if the user just tabs over or clicks in another field no alert is set off.

Calculate, will fire off each alert when one of them is triggered, which seems a bit annoying. Any suggestions to get this to work without trigger all the alert at once?

I'm open to other suggestions as well. Thanks!

Acrobat SDK and JavaScript , Windows







Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation