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

Help Needed Please

New Here ,
Aug 17, 2017 Aug 17, 2017

I try create catalogue with buy option and i stuck on the one thing I need to create java script which after clicking on add to cart button will transfer Qty (filed by customer) to last page where is order .At the moment when customer click on cart code, product description and price are transferred just stuck on Qty.

Capture1.PNGCapture.PNG

TOPICS
Acrobat SDK and JavaScript , Windows
660
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

correct answers 1 Correct answer

Community Expert , Aug 17, 2017 Aug 17, 2017

Use this:

Quant.value = this.getField("Qty." + added).value;

Translate
Community Expert ,
Aug 17, 2017 Aug 17, 2017

What code do you use at the button?

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
New Here ,
Aug 17, 2017 Aug 17, 2017

This is code for Button

var thename = this.getField(event.target.name);

N = thename.name.substring(4,thename.name.length);

AddToCart(N);

And add to cart function is

function AddToCart(added)

{

this.calculate = false;

var lstItemNum = this.getField("lstItemNum")

var lstItem = this.getField("lstItem")

var lstPrice = this.getField("lstPrice")

IName = lstItem.getItemAt(added-1)

/* original script

var NI = this.getField("TotalNumItems");

NI.value = NI.value+1

var Dest = this.getField("Description."+NI.value)

var INum = this.getField("INum."+NI.value)

var UPrice = this.getField("UPrice."+NI.value)

var Quant = this.getField("Quantity."+NI.value)

var TPrice = this.getField("TPrice."+NI.value)

Dest.value = IName

INum.value = lstItemNum.getItemAt(added-1)

UPrice.value = lstPrice.getItemAt(added-1)

Quant.value = "1"

TPrice.hidden = false

*/

// corrected script

{

var NI = this.getField("TotalNumItems");

NI.value = NI.value+1

var Dest = this.getField("Description."+NI.value)

var INum = this.getField("INum."+NI.value)

var UPrice = this.getField("UPrice."+NI.value)

var Quant = this.getField("Quantity."+NI.value)

var TPrice = this.getField("TPrice."+NI.value)

Dest.value = IName

INum.value = lstItemNum.getItemAt(added-1)

UPrice.value = lstPrice.getItemAt(added-1)

Quant.value = "0"

TPrice.hidden = false

}

// end correction

this.calculate = true

}

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 ,
Aug 17, 2017 Aug 17, 2017

You must change following line:

Quant.value = "0";

Quant.value = ... insert here the value of the field ... ;

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
New Here ,
Aug 17, 2017 Aug 17, 2017

But this can be filled out by customer and can be any number they put in this field

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 ,
Aug 17, 2017 Aug 17, 2017

Yes, take the value of the field:

this.getField(" field name ").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
New Here ,
Aug 17, 2017 Aug 17, 2017

That is what i mean but more tricky part is when they press buy.1 should show Qty.1 but when buy.2 Qty.2 etc. Any idea you was so helpful ThanksCapture.PNG

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
LEGEND ,
Aug 17, 2017 Aug 17, 2017

Different script for each field

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 ,
Aug 17, 2017 Aug 17, 2017

Use this:

Quant.value = this.getField("Qty." + added).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
New Here ,
Aug 17, 2017 Aug 17, 2017
LATEST

Thank you very much

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