Skip to main content
teresef69
Known Participant
July 9, 2018
Question

Form in Adobe Acrobat Pro DC.

  • July 9, 2018
  • 4 replies
  • 1730 views

These are the 4 columns I am working with;

Column A is GST Yes or No

Column B is GST Exclusive Amount

Column C is Inclusive GST

Column D is = Total

I would like the user to tick Yes (A) and add GST in (C) 

and if the user ticks No (A) to NOT add the GST

what is the simple notation I need to use?

This topic has been closed for replies.

4 replies

teresef69
teresef69Author
Known Participant
July 18, 2018

Thankyou!

teresef69
teresef69Author
Known Participant
July 18, 2018

SyntaxError:missing;before statement1:at line2

This is the script I am using in the Total Field

varsGST=("Check1").*0.1;

varExclusive_GST=+GSTExcAmtRow1("GST_Exclusive_Amount").*0.0;

varInclusive_GST=+GSTRow1("GST_Inclusive_Amount").*0.1;

*0.1.=sGST==="Yes"? Inclusive_GST:exclusive_GST;

Inspiring
July 18, 2018

There are a number of problems with that code. I believe that first line should be:

var sGST = getField("Check1").value * 0.1;

But if "Check1" is a check box, multiplying it's value by 0.1 isn't going to work when it's not selected and it's value is the string "Off". The other lines have similar problems and I can't follow the logic of what you posted. For example, in the second line of code, it seems you're multiplying the field value by 0.0 (zero), which doesn't make sense.

teresef69
teresef69Author
Known Participant
July 10, 2018

Thankyou George for your reply. I am new to Form creating so I do not quite understand.

Below is a snip of the Form I am Creating

Field Names:

Column A is YesCheck1 or NoCheck1 (both Check Boxes)

Column B is GSTExcAmtRow1

Column C is GSTRow1 (value=*0.1)

Column D is = TotalRow1

Do I go into the properties of the Check Box - Under Action - Select : Run JavaScript and add

varGSTRow1=YesCheck1("GSTRow1").*0.1   - This comes up with a Syntax Error? 

or I may be interpretating the Java Script wrong?

Inspiring
July 10, 2018

What are the field names for the Yes and No check boxes, and what are their respective export values?

You should not place any scripts in either of the check boxes. What I suggested was a custom calculate script for the Total field, but it will have to be modified now that I know how the form is setup.

teresef69
teresef69Author
Known Participant
July 10, 2018

Hi George

The Field names are:

YesCheck1 and NoCheck1

Yes = *0.1 (10%)

No = 0 none

Does this answer your question?

Terese Falconer | Corporate Services Support Officer (Part time: 9:30am - 12:30pm Mon to Fri) | T: +61 2 6102 7033 |

National Portrait Gallery | GPO Box 1400 Canberra 2601

<http://portrait.gov.au>

<https://www.facebook.com/PortraitAu/> <https://twitter.com/PortraitAu> <https://www.facebook.com/PortraitAu/> <https://twitter.com/PortraitAu> <https://www.instagram.com/portraitau/> <https://www.instagram.com/portraitau/>

Inspiring
July 9, 2018

You will have to use JavaScript. It's not entirely clear to me what you want to do based on your description, but the following would seem to make sense as the custom calculate script for the Total field:

// Get the value of the check box

var sGST = getField("GST_Checkbox").value;

// Get the value of the exclusive GST amount, as a number

var Exclusive_GST = +getField("GST_Exclusive_Amount").value;

// Get the value of the inclusive GST amount, as a number

var Inclusive_GST = +getField("GST_Inclusive_Amount").value;

// Set this field's value, depending on whether the GST checkbox is selected

if (bGST !== "Off") {

    event.value = Inclusive_GST;

} else {

    event.value = Exclusive_GST;

}

You'll have to use the actual field names in the getField statements though.

That last block of code (if statement) can be simplified to:

event.value = sGST !== "Off" ? Inclusive_GST : exclusive_GST;