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

Validation of customized text fields

New Here ,
Apr 07, 2016 Apr 07, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
577
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 ,
Apr 07, 2016 Apr 07, 2016

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?

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 ,
Apr 07, 2016 Apr 07, 2016

When the user leaves the field.

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 ,
Apr 07, 2016 Apr 07, 2016

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.");

}

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 ,
Apr 07, 2016 Apr 07, 2016
LATEST

Thanks for your help.

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