No message displayed on using app.alert
Hello,
I have a problem displaying a script in Acrobat DC.
I've created a script for a form field.
I use the javscript instruction "app.alert" to display the message corresponding to the result of a validation check of the data entered, but the message is not displayed.
Can you please tell me why the message is not displayed?
Here's the script:
// Replace "MINI-TENNIS" and "DATE OF BIRTH" with the actual IDs of your fields in the form
var caseMiniTennis = this.getField("MINI-TENNIS");
var caseBirthDate = this.getField("BIRTHDATE");
// Check if the MINI-TENNIS box is ticked
if (caseMiniTennis && caseMiniTennis.isBoxChecked(0)) {
// Get the date of birth entered
var dateBirth = champDateBirth.value;
// Check whether the date of birth corresponds to a child aged 5 to 7
var yearYear = new Date().getFullYear();
var debutSaison = new Date(anneeEnCours - 7, 8, 1); // Start date for a 7-year-old child
var finSaison = new Date(anneeEnCours - 5, 7, 31); // End date for a 5-year-old child
var dateBirthObj = new Date(dateBirth);
// Check if date of birth is in the range 5 to 7 years old
if (debutSaison <= dateNaissanceObj && dateNaissanceObj <= finSaison) {
app.alert("The date of birth corresponds to a child aged 5 to 7: " + dateBirth);
} else {
app.alert("The date of birth does not correspond to a child aged 5 to 7: " + dateBirth);
}
} else {
app.alert("The MINI-TENNIS box is not checked.");
}
Thank you.
