Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Help with check boxes and actions

Avatar

Level 1

Hi,

I have just downloaded a trial version of LiveCycle Designer ES2 to see if this program will work for the company that I work for. I need to create order forms for our products that our customers can fill out online and then e-mail to our sales department.

I have imported our current order form to LiveCycle as an artwork and have inserted checkboxes onto the form. I would like the form to automatically add the price of the option they've checkmarked to the total retail price at the bottom of the form. Do you have any suggestions for me?

Thanks!

Stefan

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Stefan,

LC Designer is a very powerful application. While you can drag and drop objects onto the form, to really get things moving you will need to put some script in objects. This allows you to control how the form will behave depending on users actions.

To begin with there is help. If you have a look at Action Builder under the Tools menu, you can select an object and then using plain English instructions build up the interaction you want. When you click okay, LC Designer will insert the necessary script.

Starting out, there can be a steep learning curve, so it depends on how comfortable you are to roll up your sleeves and do some scripting.

You should first set up your workspace. This tends to be a personal preference, but below is a basic layout.

Parallels Desktop2.png

It is a bit small, due to scale, but you get the idea. At any time you should be able to see the page, the hierarchy and the script editor. The object library and object palette and other palette should be close to hand as well.

I would NOT be inclined to import the existing form as artwork. This can limit the in-built options in LC Designer later. You could save your existing form as a JPEG and then in a new form use the image object (set to full page size) to show the image of the existing form.

[ALTERNATIVELY: you can also add fields to an existing PDF in Acrobat].

In relation to the scripting the following JavaScript should work in the click event of the checkbox (on the basis that the other field is named totalPrice).

if (this.rawValue == 1)

{

     totalPrice.rawValue = totalPrice.rawValue + 10;

}

else

{

     totalPrice.rawValue = totalPrice.rawValue - 10;

}

This should take into account if the user changes their mind and unticks the checkbox.

One thing to bear in mind about forms developed in LC Designer, is that the features that will be available in the form (like submit by email in PDF format) will depend on whether the user has Acrobat OR Reader, and also on whether the form has been Reader Enabled (and how it was enabled). There is more information here: http://assure.ly/gYyYc2.

I would strongly recommend JP Terry's book on LC Designer which is excellent - "Creating Dynamic Forms with Adobe LiveCycle Designer". This starts at the beginning and clearly sets out key learning points. By the end there are some good examples, which you can copy across into your forms.

We have some solutions and blog posts on our website http://www.assuredynamics.com.

There is also a range of online resources. You may find these resources helpful:

http://www.adobe.com/go/learn_lc_scriptingBasics

http://www.adobe.com/go/learn_lc_scriptingReference

http://www.adobe.com/go/learn_lc_formCalc

http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_M odel_Refer ence.pdf

http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf

And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

The Help file in LC Designer can also help you with syntax and LC Designer itself comes with some great templates and examples.

Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/

Also a book that doesn't deal with scripting at all but is very good on form layout is "Forms that Work" by Caroline Jarrett and Gerry Gaffney.

The Adobe "PDF Forms Bible" is okay, but mainly focuses on AcroForms.

Windjack Solutions have a subscription based service for solutions and scripts athttp://www.pdfscripting.com. It has a lot of AcroForm script that can be amended to suit LC Designer and a growing library of LC Designer solutions.

I hope that helps,

Niall

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Hi Stefan,

LC Designer is a very powerful application. While you can drag and drop objects onto the form, to really get things moving you will need to put some script in objects. This allows you to control how the form will behave depending on users actions.

To begin with there is help. If you have a look at Action Builder under the Tools menu, you can select an object and then using plain English instructions build up the interaction you want. When you click okay, LC Designer will insert the necessary script.

Starting out, there can be a steep learning curve, so it depends on how comfortable you are to roll up your sleeves and do some scripting.

You should first set up your workspace. This tends to be a personal preference, but below is a basic layout.

Parallels Desktop2.png

It is a bit small, due to scale, but you get the idea. At any time you should be able to see the page, the hierarchy and the script editor. The object library and object palette and other palette should be close to hand as well.

I would NOT be inclined to import the existing form as artwork. This can limit the in-built options in LC Designer later. You could save your existing form as a JPEG and then in a new form use the image object (set to full page size) to show the image of the existing form.

[ALTERNATIVELY: you can also add fields to an existing PDF in Acrobat].

In relation to the scripting the following JavaScript should work in the click event of the checkbox (on the basis that the other field is named totalPrice).

if (this.rawValue == 1)

{

     totalPrice.rawValue = totalPrice.rawValue + 10;

}

else

{

     totalPrice.rawValue = totalPrice.rawValue - 10;

}

This should take into account if the user changes their mind and unticks the checkbox.

One thing to bear in mind about forms developed in LC Designer, is that the features that will be available in the form (like submit by email in PDF format) will depend on whether the user has Acrobat OR Reader, and also on whether the form has been Reader Enabled (and how it was enabled). There is more information here: http://assure.ly/gYyYc2.

I would strongly recommend JP Terry's book on LC Designer which is excellent - "Creating Dynamic Forms with Adobe LiveCycle Designer". This starts at the beginning and clearly sets out key learning points. By the end there are some good examples, which you can copy across into your forms.

We have some solutions and blog posts on our website http://www.assuredynamics.com.

There is also a range of online resources. You may find these resources helpful:

http://www.adobe.com/go/learn_lc_scriptingBasics

http://www.adobe.com/go/learn_lc_scriptingReference

http://www.adobe.com/go/learn_lc_formCalc

http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_M odel_Refer ence.pdf

http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf

And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

The Help file in LC Designer can also help you with syntax and LC Designer itself comes with some great templates and examples.

Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/

Also a book that doesn't deal with scripting at all but is very good on form layout is "Forms that Work" by Caroline Jarrett and Gerry Gaffney.

The Adobe "PDF Forms Bible" is okay, but mainly focuses on AcroForms.

Windjack Solutions have a subscription based service for solutions and scripts athttp://www.pdfscripting.com. It has a lot of AcroForm script that can be amended to suit LC Designer and a growing library of LC Designer solutions.

I hope that helps,

Niall

Avatar

Level 1

Hi,

I have tried entering in the script that you wrote in your last post, but when I preview the form, the "totalPrice" is already calculated, and it doesn't change at all once I click on the check box. Does this have to do with the fact that it's a "rawValue" that I'm using? Does that just take the initial value of the checkbox?

Ultimately, I would like the totalPrice to add 10 only when I click on the check box, but also when I uncheck the checkbox I would like the form to subtract that 10 that it added previously. Thanks for your help!

Stefan

Avatar

Level 10

Hi Stefan,

Here is an example with the script in the click event of four checkboxes:

https://acrobat.com/#d=SNB64dj4NEc4E2LhE-yISQ

Hope this helps,

Niall

Avatar

Level 1

Hello Niall - how do I open the link you posted above?  I've registered for the Adobe sites, but the link always takes me to Adobe's subscription service page.

Avatar

Level 6

Niall hasn't been around for a few months. You can get to the document here: https://workspaces.acrobat.com/app.html#d=SNB64dj4NEc4E2LhE-yISQ