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

Need an if then statement in dropdown

New Here ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I would like to apologize in advance, I'm not very comfortable with Java. Perhaps you all can help me come up with a solution to the form I am working on.

 

My form is for samples.  I've been using a fillable field for the first sample, then every sample thereafter calculates +1. I would like to have the form stay empty and NOT autofill if we don't have enough samples to fill every row in the form. I've considered doing an if then statement in a dropdown, where the sample ID has a prefix in a dropdown. If the prefix is "A", the sample ID is +1. If the prefix is "N/A", the sample ID field is blank. I can get the "A" to work, but not the "N/A".

 

Another idea was maybe a button called "END" that is visible but doesn't print. Pressing "END" would hide all following fields, and pressing it again would show them again. I can get it to hide the fields, but pressing it again doesn't show them again.

 

Thanks in advance for all your help,

Ali

TOPICS
Acrobat SDK and JavaScript , Windows

Views

37

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
Community Expert ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

Hi,

 

Can you share the code you are using and we can then help by pointing out the issues.

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
Community Expert ,
Sep 10, 2021 Sep 10, 2021

Copy link to clipboard

Copied

LATEST

Here is example how to show/hide fields with a button:

as 'Mouse UP' event of a button select 'Run a JavaScript' and add this code:

this.getField("Text1").display = this.getField("Text1").display == display.visible ? display.hidden : display.visible;
this.getField("Text2").display = this.getField("Text2").display == display.visible ? display.hidden : display.visible;

Thats example for two fields "Text1" and "Text2", you can replicate line to add more fields,change field names to your actual names.

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