Help Needed Please

New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this:

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

114

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Help Needed Please

New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this:

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

115

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 17, 2017 0
Adobe Community Professional ,
Aug 17, 2017

Copy link to clipboard

Copied

What code do you use at the button?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

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

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
Adobe Community Professional ,
Aug 17, 2017

Copy link to clipboard

Copied

You must change following line:

Quant.value = "0";

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
Adobe Community Professional ,
Aug 17, 2017

Copy link to clipboard

Copied

Yes, take the value of the field:

this.getField(" field name ").value;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
Most Valuable Participant ,
Aug 17, 2017

Copy link to clipboard

Copied

Different script for each field

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
Adobe Community Professional ,
Aug 17, 2017

Copy link to clipboard

Copied

Use this:

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0
New Here ,
Aug 17, 2017

Copy link to clipboard

Copied

Thank you very much

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 17, 2017 0