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

Adobe Acrobat Pro Dc - JavaScript to show/hide Fields based on drop Down Choices

New Here ,
Jan 28, 2021 Jan 28, 2021

Hello, 

I'm very new to Java Script and I'm trying to create a form that will only show certain fields dependant on what is selected in the drop down menu. Can you please help me figure out what is wrong with my code? 

If they select "Special Merit Increase" from the drop down box then I want fields "GivenFor SpecialMeritIncrease", "AmountInfo", "Enter%Step" to appear.

 

if(this.getField("Award_Type").value==("Special Merit Increase"){
event.target.display=display.visable;}
this.getField("GivenForSpecialMeritIncrease").display = fieldHide;
this.getField("AmountInfo").display = fieldHide;
this.getField("Enter%Step").display = fieldHide;

else{
if(this.getField("Award_Type").value==("Premium Pay Award")}
event.target.display=display.visable;}
this.getField("GivenForPremiumPay").display = fieldHide;
this.getField("PremiumPayAmount").display = fieldHide;
this.getField("$TotalAmount").display = fieldHide;
this.getField("$WeeklyAmount").display = fieldHide;

 

Thank you advance! 

3.2K
Translate
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
1 ACCEPTED SOLUTION
New Here ,
Jan 28, 2021 Jan 28, 2021

Update: 

 

I got it to work using the following code:

 

if(this.getField("Award_Type").value=="Special Merit Increase"){
this.getField("GivenForSpecialMeritIncrease").display = display.visible;
this.getField("AmountInfo").display = display.visible;
this.getField("Enter%Step").display = display.visible;
}else{
this.getField("GivenForSpecialMeritIncrease").display = display.hidden;
this.getField("AmountInfo").display = display.hidden;
this.getField("Enter%Step").display = display.hidden;

if(this.getField("Award_Type").value=="Premium Pay Award"){
this.getField("GivenForPremiumPay").display = display.visible;
this.getField("PremiumPayAmount").display = display.visible;
this.getField("$TotalAmount").display = display.visible;
this.getField("$WeeklyAmount").display = display.visible;

}else{
this.getField("GivenForPremiumPay").display = display.hidden;
this.getField("PremiumPayAmount").display = display.hidden;
this.getField("$TotalAmount").display = display.hidden;
this.getField("$WeeklyAmount").display = display.hidden;
}
}

View solution in original post

Translate
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 ,
Jan 28, 2021 Jan 28, 2021

Update: 

 

I got it to work using the following code:

 

if(this.getField("Award_Type").value=="Special Merit Increase"){
this.getField("GivenForSpecialMeritIncrease").display = display.visible;
this.getField("AmountInfo").display = display.visible;
this.getField("Enter%Step").display = display.visible;
}else{
this.getField("GivenForSpecialMeritIncrease").display = display.hidden;
this.getField("AmountInfo").display = display.hidden;
this.getField("Enter%Step").display = display.hidden;

if(this.getField("Award_Type").value=="Premium Pay Award"){
this.getField("GivenForPremiumPay").display = display.visible;
this.getField("PremiumPayAmount").display = display.visible;
this.getField("$TotalAmount").display = display.visible;
this.getField("$WeeklyAmount").display = display.visible;

}else{
this.getField("GivenForPremiumPay").display = display.hidden;
this.getField("PremiumPayAmount").display = display.hidden;
this.getField("$TotalAmount").display = display.hidden;
this.getField("$WeeklyAmount").display = display.hidden;
}
}

Translate
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 ,
Apr 21, 2021 Apr 21, 2021

Trying to do something similar here. 

 

I only have two Conditions in my Drop Down Menu: 

If Drop Down (Contract Date) = Contract Start Date, Do Not Show Fields - Prorated Service Start Date Text, Prorated Service Start Date, or Prorated Invoice to Follow. 

 

If Drop Down (Contract Date) = Renewal Date, Do Show Fields - Prorated Service Start Date Text, Prorated Service Start Date, or Prorated Invoice to Follow. 

Translate
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 ,
Apr 22, 2021 Apr 22, 2021

- Remove the Mouse Down actions you added. You should only do it using a script.

- Set the drop-down field to commit the selected value immediately, under Properties - Options.

- There's an error in your code. The field name is just "Term of Agreement", not "Term of Agreement#1".

Translate
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 ,
Apr 22, 2021 Apr 22, 2021
LATEST

Thank You!!! 

Translate
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