Java if command for adobe pdf form

New Here ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

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.

Capture.PNG

TOPICS
Acrobat SDK and JavaScript, Windows

Views

221

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

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

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 17, 2018 Oct 17, 2018

Copy link to clipboard

Copied

LATEST

what if i add a blank field to the drop down cause sometime when they take a pc the may not take the power cord or mouse so none would be the answer. or can i even do that what would be my best solution.

i want it to work so that if they take a device they put the tag# in the D1 field once that field has that info i then want drop down to then be required to have an answer and also date out and date in be required for that device before the form can be submitted. if there is an easier way to achieve this i can change how it needs to be and my options in the dropdown is power cord, mouse, both or none.

Thanks

Likes

Translate

Translate

Report

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