Expand my Community achievements bar.

SOLVED

Need Help: Check box auto fill value in text field and text field calculation

Avatar

Level 2

Noob to this site.

So i currently have a form fillable which I'm wondering if certain actions are possible. I'm fairly new to real technical aspects of livecycle so spare with me if you can.

I have a series of 4 check boxes with values assign to each. Below the 4 check boxes i have an additonal 4 text fields that atleast one of the fields pertain to any of the 4 checkbox selections possible.

ok, here we go so spare with me:

     Is it possible to tie the 4 check boxes to the text field below, meaning when you click any of the 4 check boxes, the value included next to the check box will auto fill in the text field below pertaining to the 4 selections possible?

     Second question: how can i modify the text fields to auto calculate numerical values with the 4th text field ending in the calculation result?

example below

Accrual per Year
Check Box
100
120
144
160


Text Fields
Comments
Current Vacation Balance

Minus Accrual for One Year
--->  This is where i want the above check box to auto fill when selected above
( = )
i want this field to subtract 1st filed and 2nd field givign me the total

Hours Eligible to convert:

50% of balance above


i want this field to take the above total field and divide it by 2

Can anyone help please. Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

If I work on the basis that the four objects in the table are called:

  1. currentBalance
  2. accrual
  3. balance
  4. eligibleHours

Then if you go to the 3rd field (balance) and have the following in the calculate event (JavaScript):

this.rawValue = currentBalance.rawValue - accrual.rawValue;

In the 4th field (eligibleHours) and have the following in the calculate event (JavaScript):

this.rawValue = balance.rawValue / 2;

Niall

View solution in original post

26 Replies

Avatar

Level 10

Glad you have it working!

First of all, I would strongly recommend that you only display Names in the hierarchy view, as displaying Captions is not much use from a scripting point of view. You can change this from the pull out menu:

Parallels Desktop1.png

Secondly, I would uniquely name objects as you develop the form. This will avoid the necessity to have to resolve the nodes as is the case in your script.

Good luck,

Niall

Avatar

Level 2

Thanks a million for your help, knowledge and not to mention patience. Without your assistance i would have been lost in the world of scripts as it is new to me right now lol.

Avatar

Level 2

will do, i will keep your tips in mind. Thanks Niall.

Avatar

Level 2

is this site good for finding scripts samples if needed

http://www.assuredynamics.com/index.php/code-solutions/

or what is a good resourceto learn scripts when needed.

Avatar

Level 10

You're welcome - glad I could help!

I hope that website is good, as it is our site ;-)

I would recommend JP Terry’s book “Creating dynamic forms in Adobe LiveCycle Designer”. It is an excellent starting point.

There are a lot of resources available online, which can help:
 
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_Reference.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 at http://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.

Last tip: I would look at how you set up your workspace, in particular dragging down the Script Editor so that you can see more than a single line of script:

LC Designer Workspace.png

Niall

Avatar

Level 2

Will do, thanks Niall for your superior knowledge.