-
1. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
Gilad D (try67) Nov 6, 2014 1:26 AM (in response to sgdfxfslkcmz)1. Yes, you can use something like this as the check-box's MouseUp event:
if (event.target.value=="Off") this.getField("Field1").display = display.hidden; else this.getField("Field1").display = display.visible;2. Yes, but only if the calculation is done with a script, not with the built-in simplified calculation options in Acrobat.
A simple example: conditionally adding the values of 3 fields, if they're visible.
var total = 0; if (this.getField("Field1").display==display.visible) total+=Number(this.getField("Field1").value); if (this.getField("Field2").display==display.visible) total+=Number(this.getField("Field2").value); if (this.getField("Field3").display==display.visible) total+=Number(this.getField("Field3").value); event.value = total; -
2. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
sgdfxfslkcmz Nov 6, 2014 11:38 PM (in response to Gilad D (try67))Hi Gilad,
Thank you very much for taking the time to help -- the Checkboxes now work the way I hoped they would!
However, I can't get the Total box to work. This is what I have in the Calculation script properties:
var total = 0;
if (this.getField("ROAE Fun Ride").display==display.visible) total+=Number(this.getField("ROAE Fun Ride").value);
if (this.getField("2015 BMMC Membership").display==display.visible) total+=Number(this.getField("2015 BMMC Membership").value);
if (this.getField("2015 BCORMA Membership").display==display.visible) total+=Number(this.getField("2015 BCORMA Membership").value);
if (this.getField("Donatin Amount").display==display.visible) total+=Number(this.getField("Donatin Amount").value);
event.value = total;
Have I made a mistake somewhere?
-
3. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
Gilad D (try67) Nov 7, 2014 12:17 AM (in response to sgdfxfslkcmz)Seems fine to me... Are there any errors in the JS console?
On Fri, Nov 7, 2014 at 8:38 AM, sgdfxfslkcmz <forums_noreply@adobe.com>
-
5. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
George Johnson Nov 7, 2014 12:34 AM (in response to sgdfxfslkcmz)The field name is "Donation Amount", not "Donatin Amount", and the resulting error does show up in the JavaScript console. I recommend that you enable the following preference: Edit > Preferences > JavaScript > Show console on errors and messages
so that you notice errors when they happen.
-
6. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
sgdfxfslkcmz Nov 7, 2014 12:51 AM (in response to George Johnson)Hi George, good eye in catching my spelling error -- thanks very much!
The Total box works now, but in a bit of a strange way -- it seems to be one Checkbox behind. It shows $20 right off the bat which is what I expected to see because the first Checkbox line is read only and cannot be deselected. However, when I select the second Checkbox (BMMC for $20), the Total box does not update until the next Checkbox is selected, and so forth.
Can this be corrected?
Also, I wonder if I made things unnecessarily complicated by using hidden fields, etc. Maybe I should've just had the 4 Checkboxes (plus the donation amount box), and left the dollar amounts ($20, $20, and $45) as plain text...
-
7. Re: Almost Finished: Plz Help With Calculation/Checkbox And Hidden Fields
George Johnson Nov 7, 2014 2:26 AM (in response to sgdfxfslkcmz)That type of thing usually means the field calculation order is not correct, so just set it to what makes sense.


