Skip to main content
Participant
October 17, 2018
Question

Java if command for adobe pdf form

  • October 17, 2018
  • 2 replies
  • 1160 views

i want to create a if command so that if field D1 has anything typed into it then another field Dropdown1 becomes required but dont know how to write it out for adobe pdf form. Any help would be greatly appreciated.

This topic has been closed for replies.

2 replies

Inspiring
October 17, 2018

You say that the dropdown should become required, but required for what? It could be required in order to submit, save, print, move on to the next section, etc. Also, since a dropdown (normally) always has a value (e.g., is not blank), submitting will never be blocked, if None is selected for example, unless you code a custom routine that controls things.

Participant
October 17, 2018

yeah the dropdown needs to be selected before they can submit the form.

Thanks

Inspiring
October 17, 2018

The required property comes into play with a "Submit a form" or the submitForm JavaScript method in that the submit won't be allowed to take place unless all fields that are required are non-blank. Dropdowns will normally not ever be blank, so making them required won't prevent the submit from taking place. The workaround is to use a script to check all required fields and only allow the submitForm JavaScript statement to execute if the field values check out. In your case, it appears as though you want to submit only if the dropdown values are something other than "None" when the corresponding Tag # is not blank. This type of control is not something that will happen automatically simply be setting the required property of fields, you'll need to create a custom script.

try67
Community Expert
Community Expert
October 17, 2018

Read this tutorial: https://acrobatusers.com/tutorials/conditional-execution

It's important to realize that the language used in Acrobat is JavaScript, not Java. Similar names but quite different languages.