Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript performs differently on Mac than on PC.

New Here ,
Aug 11, 2021 Aug 11, 2021

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
1.8K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
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.

View solution in original post

Translate
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
Community Expert ,
Aug 11, 2021 Aug 11, 2021

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

Translate
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

Yes, that checkbox is ticked on all of the dropdown fields.

Translate
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
Community Expert ,
Aug 11, 2021 Aug 11, 2021

What application does he use?

JavaScript may not work properly on different  application.

Translate
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

He is using Acrobat Pro DC on MacOS

Translate
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
Community Expert ,
Aug 11, 2021 Aug 11, 2021

Is he working with forms in Preview?

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

Translate
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

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.

Translate
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
Community Expert ,
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.

Translate
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
LATEST

That appears to have been the problem.

Translate
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