Skip to main content
Participant
July 10, 2023
Question

Drop down selection display a selection in another drop down list and enters a value in a field

  • July 10, 2023
  • 1 reply
  • 372 views

I have 2 drop downs and a field that I am working with.

 

They are labeled as:

POS (this is dropdown 1 with an option labeled "JK POS Bundle")

PIN_PAD (this is dropdown 2 with an option labeled "PAX A35")

PINPAD_QTY (this is a blank field)

 

What I would like to do is the following:

When a user chooses the option "JK POS Bundle" from the POS dropdown list, the PIN_PAD dropdown list will show the option "PAX A35". I would also like it to populate the number "1" in the PINPAD_QTY field.

 

Below is what I have as a custom validation script in the POS dropdown. It is able to show "PAX A35" in the PIN_PAD dropdown list. I am unsure how to populate the number "1" in the PINPAD_QTY field at this point. Any assistance would be greatly appreciated.

var PIN_PADField = this.getField("PIN_PAD");

if (event.value=="JK POS Bundle" || event.value=="PAX A35")

    PIN_PADField.value = "PAX A35";

else PIN_PADField.value = PIN_PADField.defaultValue;

 

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 10, 2023

Just duplicate what you already have...

 

 

var PIN_PADField = this.getField("PIN_PAD");
var PINPAD_QTYField = this.getField("PINPAD_QTY");
if (event.value=="JK POS Bundle" || event.value=="PAX A35") {
    PIN_PADField.value = "PAX A35";
	PINPAD_QTYField.value = "1";
} else {
	PIN_PADField.value = PIN_PADField.defaultValue;
	PINPAD_QTYField.value = "";
}

 

Edit: small mistake in the code fixed

 

Participant
July 11, 2023

Thanks for your assistance, but I need some clarification.

I copied your provided code as a custom validation script in the POS dropdown.

I was able to produce the same result of populating "PAX A35" in the PIN_PAD field, but still no luck with populating the number "1" in the PINPAD_QTY field.

Please let me know if I'm doing something wrong on my end.

try67
Community Expert
Community Expert
July 11, 2023

I can't answer that without seeing the actual file with the code in it...