Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Version Check

Avatar

Level 2

Hi everyone,

Our LCD form does an Adobe Acrobat Reader version check before it opens, using the following JS:


if (parseFloat(app.viewerVersion) < 12)

  {

  xfa.host.messageBox("If you are seeing this message, your version of Adobe Acrobat Reader may be outdated.\n\nFor best user experience, please download the latest version of Adobe Acrobat Reader DC at https://get.adobe.com/reader.", "Adobe Acrobat is outdated", 0, 0);

  }

However, many of our users are going to get annoyed by how often they see this prompt, if they can't or won't update their Reader to the latest version. Is there a way to add a check box to the message box that allows the user to suppress future notices of this kind? Such as "[ ] Do not tell me to update anymore"?

I feel like this might not be possible, since it seems like it would be a program-level change (rather than something that could be remembered for the form, itself), but I figured I'd try asking about it, just in case.

Thanks for taking the time to read my question!

JLN

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Radzmar and MinusZero,

 

I'm dying to try it, but I haven't quite gotten to it yet. I'll definitely post about my success/failure once I do, though!

 

I really appreciate your taking the time to talk me through it--this is extremely helpful.

 

JLN

 

UPDATE: This worked, thanks so much!

if (parseFloat(app.viewerVersion) < 12)

  {

  xfa.host.messageBox("If you are seeing this message, your version of Adobe Acrobat Reader may be outdated.\n\nFor best user experience, please download the latest version of Adobe Acrobat Reader DC at https://get.adobe.com/reader.", "Adobe Acrobat is outdated", 0, 0);

  }

View solution in original post

5 Replies

Avatar

Level 7

Hi,

I have tackled something like this before. You can achieve this by using a variable, but since they can be so finicky to use I did it a much simpler way.

What do you have to do?

  • Add a hidden NumericField. Give it the value 1.
  • Add some code into the Form's Doc:Ready event.

form1::docReady - (JavaScript, client)
if(this.resolveNode("NumericField1").rawValue == "1") //checks the value of the NumericField, if it is "1" execute the code.

{
var resetText = app.alert("If you are seeing this message, your version of Adobe Acrobat Reader may be outdated.\n\nFor best user experience, please download the latest version of Adobe Acrobat Reader DC at ....\n\nHide this dialog next time?",2,2, "Adobe Acrobat is Outdated"); //show a checkbox with Yes and No buttons


if(resetText == "4") //4 equals yes
{
this.resolveNode("NumericField1").rawValue = "0"; //if Yes is clicked, change the NumericField value to 0
}
else
if(resetText == "3") //3 equals no
{
this.resolveNode("NumericField1").rawValue = "1"; //if No is clicked, change the NumericField value to 1. This isnt really needed if the value starts at 1, but if you wish to add an event to make it show again, you will want this.
}
}

if(this.resolveNode("NumericField1").rawValue == "0") //If the value of the NumericField is 0, execute this code...which is nothing.
{

}

-------------------------------------------------------------------------

When you save the form, the NumericField's contents are saved with the form so next time it is opened the code will execute and show or not show the dialog based on what was done last time and saved into the form.

If you have a form reset button you might want to reset the NumericField's value back to 1 so the form is fully resetting. Just add it to the click event of the reset button.

In your code, just add a second if statement after the version check code. eg:

if (parseFloat(app.viewerVersion) < 12)

     {

     if(this.resolveNode("NumericField1").rawValue == "1")

          {

          }

     etc etc

     }

Avatar

Level 7

MinusZero's solution will work IF the user is opening a form they saved. i.e. open it, get the message, accept the message and save the document. On reopen the solution will suppress the message, however if this is a form the user opens, fills out, submits (or emails) and they are done with it, then they will get the message every time a new form is opened. You cannot suppress this kind of message at the application layer. Additionally the question I have is that if you are going to the trouble of telling the user they need the newer version why would you suppress the message anyway? if the recommendation is to use a newer version there must be some reason for this??

Avatar

Level 10

Does this test makes sense? I mean, what feature you're using in your form that requires at least Acrobat (Reader) DC?

Avatar

Level 8

Object.defineProperty is a big one for our PDFs. Can't extend the Object class with custom methods that are non-enumerable.

Avatar

Correct answer by
Level 2

Hi Radzmar and MinusZero,

 

I'm dying to try it, but I haven't quite gotten to it yet. I'll definitely post about my success/failure once I do, though!

 

I really appreciate your taking the time to talk me through it--this is extremely helpful.

 

JLN

 

UPDATE: This worked, thanks so much!

if (parseFloat(app.viewerVersion) < 12)

  {

  xfa.host.messageBox("If you are seeing this message, your version of Adobe Acrobat Reader may be outdated.\n\nFor best user experience, please download the latest version of Adobe Acrobat Reader DC at https://get.adobe.com/reader.", "Adobe Acrobat is outdated", 0, 0);

  }