Expand my Community achievements bar.

check box scripting problem

Avatar

Former Community Member
I have a form where I need to calculate the tax of a certain dollar amount.



line12 is a numeric field where you enter the dollar amount



There are also two check boxes in a different field, checkbox1 and checkbox2.



When the first check box is checked I want it to do the following calculation:



(line12 * 2.5 / 100) the calculated tax should show up on line14



If the second check box is checked, I want line 14 to be blank.



Someone please help, all of the scripting i have tried gives me error messages.
3 Replies

Avatar

Former Community Member
Hi Lisa,



Although it will work with Checkboxes, I would suggest using radio buttons for the reason that only 1 radio button can be selected at a time. If both Checkboxes are accidently selected then you may run into problems (there would be alot of cases you would have to check).



With 2 radio buttons I put the following code in the radio button list, on the change event in javascript:



if(button1.rawValue == 1){

Line14.rawValue = ((Line12.rawValue) * 2.5/100);

}else {Line14.rawValue = null;}



Will this meet your needs or do you need to use Checkboxes?



Catherine

Adobe Systems

Avatar

Former Community Member
Lisa,



You can also format the radio button to appear like checkboxes, by changing the appearance to a "sunken square".



Catherine

Adobe Systems

Avatar

Former Community Member
Hi Catherine,



I have three check boxes and I want the user to be able to select only any two of them for that i am counting the checked items on the click of every check boxes and if its already 2 then I am setting the .rawValue of the clicked checked box to 0. Now the value of the check box is correctly set but in UI the check box looks checked.

I am using LiveCycle Designer 7 & Form server 6.

Thanx in advance for your time and efforts.



Thank you.

Praveen