These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Set Focus

patra
Registered: Oct 19 2006
Posts: 270

Is it possible when user click on a button with the script below the focus to be set into upcoming
Password required field ?
Thanks

var flag = false;

while

(flag != true)
{

var CheckPW = xfa.host.response("Password required", "Comments", "", 1);

if (CheckPW == "123"){

form1.Only.presence= "visible";

flag= true;

}

else {if (CheckPW == ""){flag= true;}

else
{xfa.host.messageBox("Wrong Password, please try again!", "",0,0);

}

}

}

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The script displays a response box for entering the password. Is the input on the response box the field you are talking about? JavaScript has no control over the UI on the popup boxes.

The problem is the Password parameter. If it is not included in the parameter list then the focus goes to the input box instead of the OK button. I think this is a bug. The dialog should have the same initial behavior regardless of what arguments are used.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

patra
Registered: Oct 19 2006
Posts: 270
Hi Thomp,
Is it possible to give me a help with this?
I use this script on click event in a button to make visible a subform(form1.Only)

Thanks for your help
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There's nothing wrong with your script. The problem is in the Response Box. Try changing the line where it is called to this:

var CheckPW = xfa.host.response("Password required", "Comments", "", 0);

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script