Implementing a Button to Check for Latest Form Version
Hi everyone,
I'm trying to generate a button in my form to allow users to check if they downloaded the latest version online by implementing the code below. For some reason, it doesn't work. I defined the URL of the server where the latest form version is hosted and the latest file name allocated, but it still doesn't run. Any idea why?
----------------------------
var versionCheckUrl = "https://example.com/checkformversion";var xhr = new XMLHttpRequest();
xhr.open("GET", versionCheckUrl, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var latestVersion = xhr.responseText;
var currentVersion = this.getField("versionField").value;
if (latestVersion === currentVersion) {
app.alert("You have the latest version of the form.");
} else {
app.alert("A newer version of the form is available. Please download it from our website.");
}
}
};
xhr.send();
