Skip to main content
Known Participant
March 24, 2017
Question

Dropdown quantity to populate three different text fields if one text field is populated

  • March 24, 2017
  • 1 reply
  • 712 views

I have one drop down named Quantity and three text fields named Qty1, Qty2 and Qty3. At the moment I'm using three checkboxes to run these scripts:

checkbox1

this.getField("Qty1").value = this.getField("Quantity").value;

checkbox2

this.getField("Qty2").value = this.getField("Quantity").value;

checkbox2

this.getField("Qty3").value = this.getField("Quantity").value;

The scripts work fine but what I'd like to do is to eliminate the checkboxes as the triggers to place the Quantity amount into Qty1, Qty2, Qty3 text fields as I make the selections. Is there a script that would enable me to simply have the drop down populate the text fields if Qty1 is filled in (and likewise for Qty2 and Qty3 fields). Or am I stuck and have to use the checkboxes to trigger? If this is possible can someone shed some light so I can see how it can be done? Thank you.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
March 24, 2017

As the custom calculation script for each of those fields simply enter:

event.value = this.getField("Quantity").value;

pdfUser1Author
Known Participant
March 24, 2017

Thanks for the help. The script you provided works well. But, it populates all three Qty fields. Is there a way to populate each field individually? Like this:

Populate Qty1 with the Quantity amount if an item from ComboBox.1 or ComboBox.2 is selected. Qty2 and Qty3 should remain blank or un-effected if populated.

then,

Populate Qty2 with Quantity amount if an item from ComboBox.3 or ComboBox.4 is selected. Qty1 and Qty3 should remain blank or un-effected if populated.

then,

Populate Qty3 with Quantity amount if item from ComboBox.5 or ComboBox.6 is selected. Qty1 and Qty2 should remain blank or un-effected if populated.

This is too far beyond me to figure out. Would you have any way of accomplishing this? Is it even possible because there's only one Quantity drop down to populate three Qty text fields. I'm learning that creating forms can be mind boggling and frustrating.

try67
Community Expert
Community Expert
March 24, 2017

You didn't mention these conditions before... What do you mean by "if an item from ComboBox.1 or ComboBox.2 is selected", exactly?

Do you mean that if one of those fields has a value that's not the default value then the field should be populated with the value from the Quantity field, otherwise it should be empty?