Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

FormCalc on Static PDF for ipad

Avatar

Former Community Member

I have created a Static PDF using Livecycle ES2. In the form I have included FormCalc scripting for extended total and grand total fields, however when we open on the ipad the totals will not calculate.

Is there a work around or fix for this?

13 Replies

Avatar

Level 10

Hi,

There are several threads on iOS devices, http://forums.adobe.com/message/3991098#3991098.

Certainly you will have more sucess with a Static PDF Form, however the extent to which functionality will be limited will depend on what the user has on the iPad.

Overall I think PDF Expert for iPad is the best. Adobe does have a free Reader for iOS, but sadly not all features are supported.

In any case I would stick with JavaScript and not use FormCalc at all for scripting requirements. FormCalc is an Adobe language for XFA Forms and may not be supported on an iOS device.

Good luck,

Niall

Avatar

Former Community Member

Niall,

This was the first time I have written any type of scripting and ended up using an online tutorial to figure it out. How can I convert this FormCalc script to JavaScript:

 

ExtendedPrice[0].rawValue

= QTY[0].rawValue *

PriceEach[0].rawValue

PDF Expert is the app we have been able to get this working with, it is just not letting my Calc feature work.

Thanks for the help!

Avatar

Level 10

Hi,

On the basis that the script is in the calculate event of ExtendedPrice, the following JavaScript should work.

this.rawValue = QTY.rawValue * PriceEach.rawValue;

Please note that this is on the basis that within the form (or within a row) there is only one QTY object and one PriceEach object.

JavaScript interprets [] as an array and therefore if there are multiple objects with the same name you would need to resolve the node of the object you want to reference. Have a look at this example form here, which tries to explain the concept of referencing objects: http://assure.ly/kUP02y.

Hope that helps,

Niall

Avatar

Former Community Member

Ok, the scripting you provided is working for the rows, muliplying the qtyXprice each for the extended amount.  But how to I calculate the grand total, I need it to add up all "Extended Pricing" and any price entered into "Shipping/Delivery", this is the script I wrote in FormCalc:

 

POTotal.rawValue

= ExtendedPrice[0].rawValue + ExtendedPrice[1].rawValue + ExtendedPrice[2].rawValue + ExtendedPrice[3].rawValue + ExtendedPrice[4].rawValue + ExtendedPrice[5].rawValue + ExtendedPrice[6].rawValue + ExtendedPrice[7].rawValue + ExtendedPrice[8].rawValue + ExtendedPrice[9].rawValue + ExtendedPrice[10].rawValue + ExtendedPrice[11].rawValue + ExtendedPrice[12].rawValue + ExtendedPrice[13].rawValue + ExtendedPrice[14].rawValue + ExtendedPrice[15].rawValue + ExtendedPrice[16].rawValue +

ShippingDelivery.rawValue

This is what I tried in JavaScript but it didn't work:

 

this.rawValue

= ExtendedPrice.rawValue +

ShippingDelivery.rawValue

I tried to looks at the link you provided, its like a forgien language to me.

Avatar

Level 10

Okay,

Are you using a Table?

If so, are all of the Rows named the same. eg Row1[0], Row1[1], Row1[2],...?

Is the ShippingDelivery in a Row that is named differently? Eg ShipRow

If the POTotal in a Row that is named differently? Eg TotalRow

Can you give a screen shot of the form in LC Designer showing the Table and the hierarchy?

Thanks,

Niall

Avatar

Former Community Member

I did not do a table, every field is individual. But yes, I did name every row the same as you described above (ExtendedPrice[0], ExtendedPrice[1], ExtendedPrice[2] ...etc). Since I was learning as a went on this, I thought this was how I had to create the form in order to allow other people to type into the "text fields."

"ShippingDelivery" is its own field, "POTotal" is its own field. Named as I put in the quotes.

I am trying to post the screen shot of the form, but its not letting me paste in the reply.

Avatar

Former Community Member

Tried this too, but its not calculating still:

 

this

= ExtendedPrice + xfa.resolveNode("ExtendedPrice[1]") +

xfa.resolveNode("ExtendedPrice[2]")

Avatar

Level 10

Hi,

It looks like you haven't used a Table object to create a grid. This would be the easiest way, as you can then drag other objects, like TextFields into the Table cells.

Never mind, the following JavaScript in the calculate event of the POTotal should work.

// First resolve the nodes

var vPrice = xfa.resolveNodes(ExtendedPrice[*]);

var vTotal = 0;

// Loop through all of the price objects

for (var i=0; i<vPrice.length; i++) {

     vTotal += vPrice.item(i).rawValue;

}

// Add in the shipping cost

vTotal += ShippingDelivery.rawValue;

// Then use the sum to set the value of the Total field

this.rawValue = sum;

Now hopefully that will work

Niall

Message was edited by: Niall O\'Donovan

Avatar

Level 10

...more haste, less speed!

I have corrected the script above as the sum variable was not declared becuase I changed it to vTotal.

Avatar

Former Community Member

Thank you for all your help today. I have to run out of the office, but will be trying the above scripting tomorrow.

Avatar

Level 10

Okay, I am really losing it now. There was still a rogue "sum" in the script. This should be the final one:

// First resolve the nodes

var vPrice = xfa.resolveNodes(ExtendedPrice[*]);

var vTotal = 0;

// Loop through all of the price objects

for (var i=0; i<vPrice.length; i++) {

     vTotal += vPrice.item(i).rawValue;

}

// Add in the shipping cost

vTotal += ShippingDelivery.rawValue;

// Then use the sum to set the value of the Total field

this.rawValue = vTotal;

Avatar

Former Community Member

Niall,

I had a chance to work on this again today. I am still stuck with the POTotal script. Here is what I have, any idea what I am missing?

var

vPrice = xfa.resolveNodes(ExtendedPrice[0]); xfa.resolveNodes(ExtendedPrice[1]); xfa.resolveNodes(ExtendedPrice[2]); xfa.resolveNodes(ExtendedPrice[3]); xfa.resolveNodes(ExtendedPrice[4]); xfa.resolveNodes(ExtendedPrice[5]); xfa.resolveNodes(ExtendedPrice[6]); xfa.resolveNodes(ExtendedPrice[7]);xfa.resolveNodes(ExtendedPrice[8]); xfa.resolveNodes(ExtendedPrice[9]); xfa.resolveNodes(ExtendedPrice[10]); xfa.resolveNodes(ExtendedPrice[11]); xfa.resolveNodes(ExtendedPrice[12]); xfa.resolveNodes(ExtendedPrice[13]); xfa.resolveNodes(ExtendedPrice[14]); xfa.resolveNodes(ExtendedPrice[15]); xfa.resolveNodes(ExtendedPrice[16]); (var 1=0; 1<vPrice.length; i++) vTotal += vPrice.item(i).rawvalue; var vTotal = 0; vTotal += ShippingDelivery.rawValue; this.rawValue =

vTotal

I still can't figure out how to screen shot you the hierarchy.

Thanks,

Kelly

Avatar

Level 10

Hi Kelly,

Here is an example: https://acrobat.com/#d=DLI5e6GU2gb6EU-GeTbPgA.

The way you were declaring the variable was incorrect. Also the for statement was incomplete and you were using "1" instead of "i".

Hope that helps,

Niall