Copy link to clipboard
Copied
Hello, I am a novice in JS , I want to validate a text field , say that this question : Enter the capital of Spain : < text field > , then the answer is there Madrid, then I want an alert "right answer" if you enter Madrid and alert " Wrong answer " if you write another word appears. Greetings.
Copy link to clipboard
Copied
Do you want this message to appear as soon as the user exits the field, or when you press a button to grade the test?
Copy link to clipboard
Copied
When the user leaves the field.
Copy link to clipboard
Copied
The use this as the custom validation script of that field:
if (event.value) {
if (event.value=="Madrid") app.alert("Right answer.",3);
else app.alert("Wrong answer.");
}
Copy link to clipboard
Copied
Thanks for your help.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now