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

Excel "IFS" statement equivalent in Forms

Community Beginner ,
Oct 02, 2025 Oct 02, 2025

This is what I'm trying to accomplish:

 

- CHOOSE ABC DEALERSHIP FROM DROP-DOWN LIST TO POPULATE TEXTBOXA

- TEXTBOXA HAS CALCULATION SCRIPT: var TETXBOXA =this.getField("DEALERSHIP").value;
event.value=TETXBOXA;

 

^^ this portion works great. Here is where I need assistance:

 

I NEED TEXTBOXB TO BE THE ADDRESS OF WHATEVER DEALERSHIP TEXTBOXA IS.

symone_1736_0-1759406818644.png

 

 

 

TOPICS
How to , PDF , PDF forms
113
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
Community Expert ,
Oct 02, 2025 Oct 02, 2025

You can use something like this as validate script of TEXTBOXA:

var dealers = {
  "Dealership1": "Address1",
  "Dealership2": "Address2",
  "Dealership3": "Address3",
  "Dealership4": "Address4",
  "Dealership5": "Address5"
};

var d = event.value;
if (dealers[d]) {
 this.getField("TEXTBOXB").value = dealers[d];} 
else {
 this.getField("TEXTBOXB").value = "";}

Be careful with field names, in your post you wrote TEXTBOXA but in your script is TETXBOXA.

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
Community Expert ,
Oct 02, 2025 Oct 02, 2025

Use a validation script at the dropdown for all text fields. 

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 ,
Oct 02, 2025 Oct 02, 2025

You can use something like this as validate script of TEXTBOXA:

var dealers = {
  "Dealership1": "Address1",
  "Dealership2": "Address2",
  "Dealership3": "Address3",
  "Dealership4": "Address4",
  "Dealership5": "Address5"
};

var d = event.value;
if (dealers[d]) {
 this.getField("TEXTBOXB").value = dealers[d];} 
else {
 this.getField("TEXTBOXB").value = "";}

Be careful with field names, in your post you wrote TEXTBOXA but in your script is TETXBOXA.

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 Beginner ,
Oct 10, 2025 Oct 10, 2025

I just went ahead and started over and made a new file. I have a dropdown list (DLRS). The options from that dropdown list (DN). I need the addresses in the "Example 1" box to populate the 3rd text box (ADD).

 

I have this script in my "DN custom validation script":

var DLRS = {
"ABC CDJR": "123 W SEASAME ST",
"ABC FORD": "234 W SEASAME ST",
"ABC HYUNDAI": "345 W SEASAME ST",
"ABC TOYOTA": "456 W SEASAME ST",
"ABC MAZDA": "567 W SEASAME ST"
};

var d = event.value;
if (DLRS[d]) {
this.getField("ADD").value = Dealers[d];}
else {
this.getField("ADD").value = "";}

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 ,
Oct 10, 2025 Oct 10, 2025

Dealers is not defined for:
this.getField("ADD").value = Dealers[d];

 

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 Beginner ,
Oct 10, 2025 Oct 10, 2025

var DLRS = {
"ABC CDJR": "123 W SEASAME ST",
"ABC FORD": "234 W SEASAME ST",
"ABC HYUNDAI": "345 W SEASAME ST",
"ABC TOYOTA": "456 W SEASAME ST",
"ABC MAZDA": "567 W SEASAME ST"
};

var d = event.value;
if (DLRS[d]) {
this.getField("ADD").value = DLRS[d];}
else {
this.getField("ADD").value = DLRS[d];}

 

Does not work

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 ,
Oct 10, 2025 Oct 10, 2025
LATEST

Try now.

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