Highlighted

Script check needed

New Here ,
Sep 10, 2020

Copy link to clipboard

Copied

Hi all,

 

I would like to have a check on the script for my checklist. It has 16 categories and for each category there are 4 options: 0 , 1 , 2 , 3 (for all the options the value is alike, so 0 =value 0, 1 =value 1, etc.)

 

at the bottom of each option there's a field: subtotal

 now I've added the following code to those fields: 

 

event.value=(this.getField("Top_0").value+this.getField("Vest_0").value +this.getField("Broek_0").value +this.getField("Panty_0").value +this.getField("Schoenen_0").value +this.getField("Haar_0").value +this.getField("Makeup_0").value +this.getField("Bril_0").value +this.getField("Oorbellen_0").value +this.getField("Ketting_0").value +this.getField("Sjaal_0").value +this.getField("Armbanden_0").value +this.getField("Ringen_0").value +this.getField("Nagellak_0").value +this.getField("Riem_0").value +this.getField("Tas_0").value)

 

event.value=(this.getField("Top_1").value+this.getField("Vest_1").value +this.getField("Broek_1").value +this.getField("Panty_1").value +this.getField("Schoenen_1").value +this.getField("Haar_1").value +this.getField("Makeup_1").value +this.getField("Bril_1").value +this.getField("Oorbellen_1").value +this.getField("Ketting_1").value +this.getField("Sjaal_1").value +this.getField("Armbanden_1").value +this.getField("Ringen_1").value +this.getField("Nagellak_1").value +this.getField("Riem_1").value +this.getField("Tas_1").value)

 

event.value=(this.getField("Top_2").value+this.getField("Vest_2").value +this.getField("Broek_2").value +this.getField("Panty_2").value +this.getField("Schoenen_2").value +this.getField("Haar_2").value +this.getField("Makeup_2").value +this.getField("Bril_2").value +this.getField("Oorbellen_2").value +this.getField("Ketting_2").value +this.getField("Sjaal_2").value +this.getField("Armbanden_2").value +this.getField("Ringen_2").value +this.getField("Nagellak_2").value +this.getField("Riem_2").value +this.getField("Tas_2").value)

 

event.value=(this.getField("Top_3").value+this.getField("Vest_3").value +this.getField("Broek_3").value +this.getField("Panty_3").value +this.getField("Schoenen_3").value +this.getField("Haar_3").value +this.getField("Makeup_3").value +this.getField("Bril_3").value +this.getField("Oorbellen_3").value +this.getField("Ketting_3").value +this.getField("Sjaal_3").value +this.getField("Armbanden_3").value +this.getField("Ringen_3").value +this.getField("Nagellak_3").value +this.getField("Riem_3").value +this.getField("Tas_3").value)

 

 

for the total field I used the (2nd) option: Value is the sum(+)

 

now when selecting the options, the total field is calculating the values correctly, only in the subtotalfields there's no value visible, so it looks like it isn't calculating. 

Can you help me with this? Is it something in the code?

Topics

Acrobat SDK and JavaScript, PDF forms

Views

121

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script check needed

New Here ,
Sep 10, 2020

Copy link to clipboard

Copied

Hi all,

 

I would like to have a check on the script for my checklist. It has 16 categories and for each category there are 4 options: 0 , 1 , 2 , 3 (for all the options the value is alike, so 0 =value 0, 1 =value 1, etc.)

 

at the bottom of each option there's a field: subtotal

 now I've added the following code to those fields: 

 

event.value=(this.getField("Top_0").value+this.getField("Vest_0").value +this.getField("Broek_0").value +this.getField("Panty_0").value +this.getField("Schoenen_0").value +this.getField("Haar_0").value +this.getField("Makeup_0").value +this.getField("Bril_0").value +this.getField("Oorbellen_0").value +this.getField("Ketting_0").value +this.getField("Sjaal_0").value +this.getField("Armbanden_0").value +this.getField("Ringen_0").value +this.getField("Nagellak_0").value +this.getField("Riem_0").value +this.getField("Tas_0").value)

 

event.value=(this.getField("Top_1").value+this.getField("Vest_1").value +this.getField("Broek_1").value +this.getField("Panty_1").value +this.getField("Schoenen_1").value +this.getField("Haar_1").value +this.getField("Makeup_1").value +this.getField("Bril_1").value +this.getField("Oorbellen_1").value +this.getField("Ketting_1").value +this.getField("Sjaal_1").value +this.getField("Armbanden_1").value +this.getField("Ringen_1").value +this.getField("Nagellak_1").value +this.getField("Riem_1").value +this.getField("Tas_1").value)

 

event.value=(this.getField("Top_2").value+this.getField("Vest_2").value +this.getField("Broek_2").value +this.getField("Panty_2").value +this.getField("Schoenen_2").value +this.getField("Haar_2").value +this.getField("Makeup_2").value +this.getField("Bril_2").value +this.getField("Oorbellen_2").value +this.getField("Ketting_2").value +this.getField("Sjaal_2").value +this.getField("Armbanden_2").value +this.getField("Ringen_2").value +this.getField("Nagellak_2").value +this.getField("Riem_2").value +this.getField("Tas_2").value)

 

event.value=(this.getField("Top_3").value+this.getField("Vest_3").value +this.getField("Broek_3").value +this.getField("Panty_3").value +this.getField("Schoenen_3").value +this.getField("Haar_3").value +this.getField("Makeup_3").value +this.getField("Bril_3").value +this.getField("Oorbellen_3").value +this.getField("Ketting_3").value +this.getField("Sjaal_3").value +this.getField("Armbanden_3").value +this.getField("Ringen_3").value +this.getField("Nagellak_3").value +this.getField("Riem_3").value +this.getField("Tas_3").value)

 

 

for the total field I used the (2nd) option: Value is the sum(+)

 

now when selecting the options, the total field is calculating the values correctly, only in the subtotalfields there's no value visible, so it looks like it isn't calculating. 

Can you help me with this? Is it something in the code?

Topics

Acrobat SDK and JavaScript, PDF forms

Views

122

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Sep 10, 2020

Copy link to clipboard

Copied

For the subtotal fields you can also use the (1st) option.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

Hi Bernd,

 

what do you mean with the 1st option?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

For the calculation: Value is the sum(+)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

No that doesn't work. Then it calculates all the options from all the 4 vertical columns and in each subtotal field it gives the same value. Then even in the total field there comes a whole different value thats incorrect. 

image.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

Can you share the form?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

I've added the file to my message

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Sep 11, 2020

Copy link to clipboard

Copied

Did you check Field calculation order? If that doesn't help,share your file here.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

I've shared the file 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

Check the Javascript console for errors.

 

There are no fields with the name "Top_0", "Vest_0", and so on.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

Yes that's exactly it. Those names belong to the radiobuttons and for that adobe didn't create a field(name) 

that's why I can't use the 1st option

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

The field names are "Top", "Vest", and so on.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

Hi,

 

As they are radio buttons you can use the isBoxChecked(index) function to check if it is checked,  So you should be able to do something like :

 

var topChecked = this.getField("Top").isBoxChecked(0);

if ( topChecked) {

// Add to total

}

 

Then just change the index to when you are counting a differnt row. ( just remember it is a 0 based index)

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 14, 2020

Copy link to clipboard

Copied

Hi Malcolm, 

Where do I add the value of the boxes and how does the formula look when I add two (or more) fields?

 

Kind regards,
Stefanie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 14, 2020

Copy link to clipboard

Copied

In your form the command 

  this.getField("Top").value 

will give you following values:


Off

Top_0

Top_1

Top_2

Top_3

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 14, 2020

Copy link to clipboard

Copied

Hi,

 

The code would look something like :

var Top = this.getField("Top");
var Vest = this.getField("Vest");
var Broek = this.getField("Broek"); 

var tempTotal = 0;
var amountToAdd = 1;
var indexToCheck = 0;

if ( Top.isBoxChecked(indexToCheck)){
tempTotal += amountToAdd;
}
if ( Vest.isBoxChecked(indexToCheck)){
tempTotal += amountToAdd;
}
if ( Broek.isBoxChecked(indexToCheck)){
tempTotal += amountToAdd;
}

event.value = tempTotal;

 

As each calculation uses the same fields you could move your calculation to a docment level javascript which would look something like :

[ to add document JavaScript, just search for "Document JavaScript" in the tools]

 

function calculateColumn ( amountToAdd, indexOfField){
var Top = this.getField("Top");
var Vest = this.getField("Vest");
var Broek = this.getField("Broek"); 

var tempTotal = 0;

if ( Top.isBoxChecked(indexOfField)){
tempTotal += amountToAdd;
}
if ( Vest.isBoxChecked(indexOfField)){
tempTotal += amountToAdd;
}
if ( Broek.isBoxChecked(indexOfField)){
tempTotal += amountToAdd;
}

return amountToAdd;
}

 

And then call it from each calculation like so:

// The first parameter is how much the count should go up by
// The second is which column you are wanting to count.
event.value = calculateColumn ( 1, 0);

 

Let us know if there are any problems.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 14, 2020

Copy link to clipboard

Copied

I've tried the code but despitely it doesn't work

Could there be anything in settings that's not correct?

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Sep 14, 2020

Copy link to clipboard

Copied

In column 0 you want all buttons to have value 0, in column 1 all buttons have value 1...etc?

so for example if you select all buttons in column 1 result will be 16, if you select all buttons in column 3 result will be 32 and total would be 48, you want it  like that?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 14, 2020

Copy link to clipboard

Copied

Yes exactly!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Sep 14, 2020

Copy link to clipboard

Copied

Try this OUTFIT_CHECKLIST_radiobuttons origineel1 and see if it works for you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 14, 2020

Copy link to clipboard

Copied

Wauw Nesa,

 

It works! Fantastic!

What did you do to get it like this?

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Sep 14, 2020

Copy link to clipboard

Copied

You didn't have correct values in your radio buttons, so I changed all of them and writed new scripts for "Nummer" fields.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 14, 2020

Copy link to clipboard

Copied

Ooh like that. Didn't know I could adjust that. Were did you change it?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 15, 2020

Copy link to clipboard

Copied

@NesaNurani:  The file works great when I download it to my computer and even when I move it from downloads to my documents and give it another name. Only when I upload the file to my mailing program, it doesn't work anymore. Do you know what the reason for this could be?

Also, when I open the file on my (I)phone, it doesn't work either...

 

Would be great if you could help me out on this. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 15, 2020

Copy link to clipboard

Copied

What app does you use on the phone?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 15, 2020

Copy link to clipboard

Copied

I've noticed now that the file works when I open it in Chrome. But in Safari it doesn't work. Also on my phone it still does not work, but I don't know exactly which application it opens the file in. Is there a way to easily whitelist the document when opening in Safari? The checkbox to allow Java script was already ticked 🤷🏼‍:female_sign:

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 15, 2020

Copy link to clipboard

Copied

For questions about Safari contact the Apple support.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 15, 2020

Copy link to clipboard

Copied

I've also checked with a friend who has only android devices. For her it gives the same problems. On her laptop the file is opened in Windows System Viewer. On her phone even the boxes with radiobuttons can't be ticked (I also have this problem when opening the file on my phone).

 

So it doesn't seem to be a Safari issue. Could there be  an option in Adobe that needs to be selected to make it work everywhere?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 15, 2020

Copy link to clipboard

Copied

Hi,

 

Those applications are not controlled by Adobe, the PDF spec is an open standard that anyone can use to create a PDF view, if you are using form features in Acrobat, then the only way to make sure that those features work as expected is to view the PDF in Adobe Acrobat/Reader.

 

On phones even the adobe reader is limited in its form capabilities ( hopefully this will change).

 

But in Windows System Viewer this is created by Microsoft based on the spec, Safari is Apples take on it, 

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Sep 15, 2020

Copy link to clipboard

Copied

ok, so if I understand correctly, there's not much I can do to fix this and it is best to just inform the users of this form to open it on their pc / laptop in Adobe or Chrome?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
BarlaeDC LATEST
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi,

 

That is correct, only guide the users to use Adobe Acrobat/Reader. As chrome is built by Google, again there is no guarentee that it's PDF viewer supports the features you want.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF