Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Javascript performs differently on Mac than on PC.

New Here ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

Hello!

 

I created a PDF for a client that has javascript in it to assign a higlight color to a check box when that option is chosen in the dropdown. (Kudos to this community for helping me figure out how to do that.) It's working as intended on my PC but when my client uses it on his mac, the dropdowns do odd things.

 

This is what he tells me.

When I click "Blue" the checkbox area turns Blue. When I click "Orange" the checkbox turns Blue, unless I click it to check it off, then it turns orange. And if I click it again to uncheck it, it stays orange. Then when I set the next one "green" both turn blue. If I click on the green one to check and uncheck, it turns green, and then if I check/un-check the orange one, THAT one turns orange, and the green one turns back to blue. And when I do the next one, they ALL turn back to blue (unless set to "none").

 

He is not referring to the form field higlighting.

Is there a conflict between PC and Mac? Did I miss something in the code?

I have attached the PDF as well as screenshots he provided.

Here is the code behind one of the dropdowns.

if(event.value == "Blue"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 0.8, 0.89, 1];}
else if(event.value == "Yellow"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 1, 1, 0.8];}
else if(event.value == "None"){
this.getField("Top Three Check Box.0").fillColor = color.transparent;}
else if(event.value == "Green"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 0.8, 1, 0.8];}
else if(event.value == "Orange"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 1, 0.8, 0.6];}
else if(event.value == "Purple"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 0.89, 0.8, 1];}
else if(event.value == "Pink"){
this.getField("Top Three Check Box.0").fillColor = ["RGB", 1, 0.8, 0.89];}

 

TOPICS
JavaScript, PDF forms

Views

53

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Aug 11, 2021 Aug 11, 2021
I know you said it's not field highlight color but in photos you provided, it looks to me that field highlight color overlay checkbox color unless he click on checkbox like he did on second photo. Tell him to try turn of "Show border hover color for field" under preferences->forms and test it.

Likes

Translate

Translate
Adobe Community Professional ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

Did he tick "Commit selected value immediately" in dropdown field properties under options tab?

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
community guidelines
New Here ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

Yes, that checkbox is ticked on all of the dropdown 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
community guidelines
Adobe Community Professional ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

What application does he use?

JavaScript may not work properly on different  application.

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
community guidelines
New Here ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

He is using Acrobat Pro DC on MacOS

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
community guidelines
Adobe Community Professional ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

Is he working with forms in Preview?

Forms opened and then saved in preview on mac can have javascript completely removed or corrupted.

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
community guidelines
New Here ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

He tried it originally and I told him that Preview disables Javascript. I told him to use Acrobat DC. He is using Acrobat Pro DC on MacOS in the examples shown.

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
community guidelines
Adobe Community Professional ,
Aug 11, 2021 Aug 11, 2021

Copy link to clipboard

Copied

I know you said it's not field highlight color but in photos you provided, it looks to me that field highlight color overlay checkbox color unless he click on checkbox like he did on second photo.

Tell him to try turn of "Show border hover color for field" under preferences->forms and test 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
community guidelines
New Here ,
Aug 17, 2021 Aug 17, 2021

Copy link to clipboard

Copied

LATEST

That appears to have been the problem.

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
community guidelines