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

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

Participant ,
Mar 23, 2017 Mar 23, 2017

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.

TOPICS
Acrobat SDK and JavaScript , Windows
642
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 ,
Mar 24, 2017 Mar 24, 2017

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

event.value = this.getField("Quantity").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
Participant ,
Mar 24, 2017 Mar 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.

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 ,
Mar 24, 2017 Mar 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?

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
Participant ,
Mar 24, 2017 Mar 24, 2017

Sorry for not including that info in my original post, but I didn't realize it at that point. Form creating changes moment to moment.

I have (1) "Quantity" drop down. (1) "Qty.1" text field. (1) "Qty.2" text field and (1) "Qty.3" text field. And, (3) text fields named A.1, A.2, and A.3. I have six Combo boxes which all have items and populates into it's own fields like this.

Using this script in Combo.1 and Combo.2 (in the Format window)

if(event.willCommit)

  this.getField("A.1").value = event.value;

then this in Combo.3 and Combo.4 (in the Format window)

if(event.willCommit)

  this.getField("A.2").value = event.value;

then this in Combo.5 and Combo.6 (in the Format window)

if(event.willCommit)

  this.getField("A.3").value = event.value;

That's not an issue. It's when I select the Quantity for that item is where I get in tangled up. Qty.1 should populate, let's say with the quantity of 2 if that's selected from the Quantity drop down, for 2 of Combo.1 or Combo.2 items populating into Qty.1 but then it should stay populated with that number until the form is Reset.

Then when I select an item from Combo.3 or Combo.4 it populates into field A.2 and the quantity from the Quantity drop down would populate that number into Qty.2 and would stay populated with that number until Reset.

And the same for the remaining Combo.5 and Combo.6 and Qty.3 and A.3.

Qty.1, Qty.1 and Qty.3 would be empty if no items are chosen from Combo.1, Combo.2, Combo.3, Combo.4, Combo.5, Combo.6, or nothing is selected from Quantity.

That should do it. I don't think I'm going to run into any other changes or modifications. What do you think?

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 ,
Mar 24, 2017 Mar 24, 2017

I'm not following what the issue is, then...

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
Participant ,
Mar 24, 2017 Mar 24, 2017

I think the best way to see what I'm trying to explain is to simply create the fields and you'll see. All the info is here. If you'd like I could create a something I could post on DropBox. The whole thing is pretty easy, but I don't have the javascript knowledge or expertise.

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 ,
Mar 24, 2017 Mar 24, 2017

Yeah, I'm not going to do that... If you want to share a file and a clear description of how it should work I'll check it out.

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
Participant ,
Mar 24, 2017 Mar 24, 2017
LATEST

DropBox is not working for me. It's very, very slow. Might I be able to just send it to you via email?

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