Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!
SOLVED

Checkbox script

Avatar

Level 2

At one point I thought I had this figured out, but now I am stumped!

I have a document where the user completes tasks by marking a checkbox.  When a checkbox is "checked", I want two different text fields to essentially add one and either count up or down based on the check.

Here's what I started with and am now stuck:

FormCalc

calculate script on a given checkbox

if (this.rawvalue == 1) then

     points_complete.rawvalue + 5

     tasks_w1d1_complete.rawvalue + 1

else

     points_complete.rawvalue - 5

     tasks_w1d1_complete.rawvalue - 1

endif

Please help!  Can provide more information as needed!...

Thanks in advance,

Mike S.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You don't need .rawValue in FormCalc. Also the lowercase 'v' may be causing a problem eg '.rawvalue'. In javascript this should be '.rawValue'.

In addition you are not actually calculating anything.

points_complete.rawvalue + 5 should read points_complete = points_complete + 5

Good luck,

Niall

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

You don't need .rawValue in FormCalc. Also the lowercase 'v' may be causing a problem eg '.rawvalue'. In javascript this should be '.rawValue'.

In addition you are not actually calculating anything.

points_complete.rawvalue + 5 should read points_complete = points_complete + 5

Good luck,

Niall

Avatar

Level 10

Use the change event instead with FormCalc as language..

if (this.rawValue == 1) then

     points_complete.rawValue  = points_complete.rawValue + 5

     tasks_w1d1_complete.rawValue = tasks_w1d1_complete.rawValue + 1

else

     points_complete.rawValue = points_complete.rawValue - 5

     tasks_w1d1_complete.rawValue = tasks_w1d1_complete.rawValue - 1

endif

You missed to assign the value to the field in your code..

Also as Niall mentioned you need to use rawValue to get or assign value..

Thanks

Srini

Avatar

Level 2

Thank you all!