Skip navigation
Currently Being Moderated

how to set the focus to a textbox after validating it ?

Apr 3, 2012 8:47 AM

Tags: #acrobat_9_pro

hello ,,,

I'm new to pdf scripting using javascript ,,,, I have a pdf form which contains many objects like textboxes , check boxes ,, etc .

so far I was able to render a textbox and insert the date once the document is opened.

now Im trying to write a function to validate "Email" textbox to make sure the email is written in a correct format ,,, I'm almost done with it but I don't know how to keep the cursor ,, or the focus inside the email textbox if the user enteres a wrong email ?

I mean I want the focus to remain on the textbox until the user enteres a correct email ?

 

 

thank you for helping.

 
Replies
  • George Johnson
    11,662 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 3, 2012 9:47 AM   in reply to haas422

    Try something like this:

     

    // Custom Validate script
    if (event.value && !eMailValidate(event.value)) {
         app.alert("Your message goes here.");
         event.target.setFocus();
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points