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

Response Box (Password)

patra
Registered: Oct 19 2006
Posts: 270
Answered

Here is my scenario..
I have a button(named:For Office Use Only) with the following script on Click event:

var cResponse = app.alert({
cMsg: "This is for Office use only! Please continue or click Cancel to exit.",
nIcon: 2, nType: 1,
cTitle: "Internal Request Form"});
// clear form only if response is "OK"
if (cResponse ==1) {
form1.Page5.Office.presence = "visible";
}

What happens when a users click the button and then Yes is:
a Hidden subform named Office become visible.

Is it possible when a user clicks on the button to enter first a password then(If Password is correct) to continue and make the subform(Office) visible?

Thanks

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well,

the password dialog can be created in this way.

var CheckPW = xfa.host.response("Password required", "Title", "", 1);if (CheckPW == "1234567890"){form1.Page5.Office.presence = "visible";}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

patra
Registered: Oct 19 2006
Posts: 270
Hi radzmar,

What will be the addition to the script in case the user enters the wrong password?

Is it possible to have a warning message like:"Incorrect Password, please try again"

Have agreat new year!

Thanks
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

ofcourse you can have a warning message.
Simply add an else condition to your current script:

var CheckPW = xfa.host.response("Password required", "Title", "", 1);if (CheckPW == "1234567890"){form1.Page5.Office.presence = "visible";}else{xfa.host.messageBox("Wrong Password!",0,0);}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

patra
Registered: Oct 19 2006
Posts: 270
Thanks radzmar for your reply.

Still I have a small issue.....when I click on the button(1) with the script below the pop-up warning window appears with two buttons OK and Cancel. That's fine, I enter the pasword and the script works no problem! But if I do not like to continue and click on the cancel button the warning window(Wrong Password, please try again!) appears which it is not wright! We like nothing to happens for the cancel button.

Also is it possible for the case when a user enters wrong password to have the pop-up window(Password requires) appears auto on screen without having to click on the button(1) again?

Thanks radzmar


var CheckPW = xfa.host.response("Password required", "Internal Request Form", "", 1);
if (CheckPW == "123")
{
form1.Page7.Office.presence ="visible";
}
else
{
xfa.host.messageBox("Wrong Password, please try again!", "",0,0);
}