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

Populate text fields if two drop downs

Community Beginner ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Hello,

 

 

I am really struggling with this form.

 

Below is the code I have been using earlier.

 

var selectedPackage = this.getField("Dropdown67").value;
if (selectedPackage==" ") event.value = "";
else if (selectedPackage=="VC 500") event.value = "7200";
else if (selectedPackage=="VC 500 Upgrade") event.value = "3000";
else event.value = "";

 

 

 

But a recent change to the form has required displaying different values on the text field based on two drop downs.

 

This is the scenario.

 

First, drop down and select the market.

In the second drop down selects the item.

 

A predefined price is displayed on the text field based on these two selections.

 

In English, If Market is UAE, item is ITEM 1, then the price is 5000

If Market is MEA, item is ITEM 1, then the price is 1000

 

 

I have worked up below code for this,

 

var pack = this.getfield("Dropdown58").value;
var pack2 = this.getfield("DP2").value;
if (pack==" " && pack2==" ") event.value = "";
else if (pack=="iCom 3 Mobile" && pack2=="UAE") event.value = "2000";
else if (pack=="iCom 4 VC Box" && pack2=="UAE") event.value = "3000";
else if (pack=="iCom Trade-In" && pack2=="UAE") event.value = "4000";
else if (pack=="ZEISS Serve" && pack2=="UAE") event.value = "5000";
else if (pack=="iCom 3 Mobile" && pack2=="MEA") event.value = "100";
else if (pack=="iCom 4 VC Box" && pack2=="MEA") event.value = "200";
else if (pack=="iCom Trade-In" && pack2=="MEA") event.value = "300";
else if (pack=="ZEISS Serve" && pack2=="MEA") event.value = "400";
else event.value = "";

 

 

 The code does not show any errors. However, it does not do anything.

I have attached the PDF as well here.

TOPICS
Create PDFs , JavaScript , PDF forms

Views

461

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

correct answers 2 Correct answers

Community Expert , May 30, 2022 May 30, 2022

Code does have errors, use this.getField not this.getfield.

Votes

Translate

Translate
Community Expert , May 30, 2022 May 30, 2022

I get a error:

TypeError: this.getfield is not a function

 

Use this.getField( )

Votes

Translate

Translate
Community Expert ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

Code does have errors, use this.getField not this.getfield.

Votes

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 ,
May 30, 2022 May 30, 2022

Copy link to clipboard

Copied

LATEST

I get a error:

TypeError: this.getfield is not a function

 

Use this.getField( )

Votes

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