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
Solved! Go to Solution.
Views
Replies
Total Likes
If I work on the basis that the four objects in the table are called:
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
Views
Replies
Total Likes
Hi,
Is the user allowed to select any number of the Accrual per Year checkboxes? Or can they only select one?
If it is intended that they can only select one, then I would change the table to a series of four radio buttons. This is a visual clue to the user that they can only select one choice.
Yes, it is very feasible to create script to do the number cruncing. But it would be best to sort out the checkbox/radio button issue first.
Niall
Views
Replies
Total Likes
well the user is required to select which of the Accrual per year that applies to him/her so yes user suppose to only select one.
So you recommend for me to change the check boxes to radial buttons instead?
Views
Replies
Total Likes
That's correct. Radio buttons are set up to be mutually exclusive and the shape lets the user know this.
There is an example here that how to set up the radio buttons and the script in the click event of the radio button exclusion group:
https://acrobat.com/#d=qE1IszHcL6589QQYB7ceGg.
There are more examples here: http://www.assuredynamics.com/index.php/code-solutions/.
Niall
Views
Replies
Total Likes
checking the links now
I'm very new to the scripts piece so lets take a look lol.
Views
Replies
Total Likes
okay, i got the radio buttons figured out and i applied the script so the radio button value appears on the numeric field.
now from the second table on my first post; how do i execute the follow action: Current Balance - (subtract) Accrual for one year field to give me a total in the ( =) field. Then have the 4th field divide total (=) field by 2 and give me a grand total in the 4th field.
Views
Replies
Total Likes
If I work on the basis that the four objects in the table are called:
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
Views
Replies
Total Likes
ok, let me give it a try.
If it wasn't for you i would be lost today. Thanks a mill Niall
Views
Replies
Total Likes
Just to warn you, this will work if the four objects are in the same container, eg subform.
If the objects are in different rows or subforms, then you will need to amend the sample script to give a relative reference from the object with the script to the objects referenced in the script.
See a summary of SMO Expressions here: http://assure.ly/kUP02y.
Niall
Views
Replies
Total Likes
well the scripts work wonderful but somehow i can't get the first script to take the first field Current Balance and subtract it by Accrual to give me a total.
what is doing is only taking the Accrual and subtracting it by its own.
I did replace the verbage CurrentBalance and Accrual by highlighting them and holding control key then clicking on their designated fields so it can be properly identified.
Think i am doing something wrong or is do i have to add something after ; in the script code
Views
Replies
Total Likes
If you are using JavaScript you will need to include a ".rawValue" after each object's name.
Can you post the script?
Niall
Views
Replies
Total Likes
just saw your warning post,
the fields are not currently in sub form, interestig enought the script worked for the bottom 3 fields leaving the first top one not working, i will put them in sub form to see if it works.
Views
Replies
Total Likes
It's not that the object have to be specifically in a subform, the warning was more to ensure your relative references were sufficient if the objects were in different subforms.
Niall
;-(
Views
Replies
Total Likes
okay the 4 fields are in subform now but the script you provided me to add on field three is still not picking up the first field
Views
Replies
Total Likes
We'll get there.
When previewing the form in Acrobat (and Designer) open the JavaScript Console (Control+J). When you interact with the form if there is a problem it should show up there. This will help debug it.
Niall
Views
Replies
Total Likes
im getting this message when i open in acrobat
Views
Replies
Total Likes
That's it. The script I gave you is JavaScript, but the language in that object's event is set to FormCalc. You just need to go in and change the language in the Script Editor.
Also looking at the screenshot, you can set up Display Patterns for the numericfields. See the Object > Field palette. Something like num{z,zzz,zz9} would do.
Niall
Views
Replies
Total Likes
Also, with the form open in Designer and you are in the Script Editor, there is a Check Syntax button to the right of the event dropdown. If you go to your script and click this, it should highlight errors in red.
Niall
Views
Replies
Total Likes
actually i had screwed up the script for the last field and that is why it is showing a crazy number but i fix it and its giving me the appropriate 2 or 3 digit number.
i did apply the script in calculate event do you suggest that i should change it?
Views
Replies
Total Likes
this is where i'm applying the scripts
if you notice i highligted the field that i'm having trouble with so that way you can see the script
Views
Replies
Total Likes
Success i got it working
i guess i had repeatedly kept adding a 1 by accident in between (field) and .rawvalue
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies