Skip to main content
Inspiring
October 2, 2025
Answered

Excel "IFS" statement equivalent in Forms

  • October 2, 2025
  • 2 replies
  • 302 views

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.

 

 

 

Correct answer Nesa Nurani

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


Try now.

2 replies

Nesa Nurani
Community Expert
Community Expert
October 2, 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.

Inspiring
October 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 = "";}

Bernd Alheit
Community Expert
Community Expert
October 10, 2025

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

 

Bernd Alheit
Community Expert
Community Expert
October 2, 2025

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