Here is my issue:
When I click on the button(Office use only) 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 wrong!
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(Office use only) again?
Thanks
var
CheckPW = xfa.host.response("Password required", "Comments", "", 1);
if
(CheckPW == "123")
{
form1.Page1.Office.presence
="visible";
}
else
{
xfa.host.messageBox("Wrong Password, please try again!", "",0,0);
}
Views
Replies
Total Likes
While I'm not sure ultimately what event the .response function triggers, but if you can find out whether or not the OK button was clicked, or the Cancel button was clicked, you could follow this logic:
var CheckPW = xfa.host.response(...);
if(buttonClicked == "OK")
{
while(CheckPW != "123"){
CheckPW = xfa.host.response(...); //keeps it looping until it's correct
}
form1.Page1.Office.presence = "visible"; //validation succeeded
}
else{
//do nothing because they hit cancel
}
Hope that gives at least some guidance
Edit: I looked into it further and if the response prompt's cancel is clicked, it is null, so your logic is:
var CheckPW = xfa.host.response(...);
if(CheckPW != null){ //OK was clicked
while(CheckPW != "123"){
CheckPW = xfa.host.response(...); //keeps it looping until it's correct
}
form1.Page1.Office.presence = "visible"; //validation success
}
Views
Replies
Total Likes
You woudl not check for null you woudl check for a "". I modified your code to look like this:
var correct_pw = false;
while (correct_pw != true){
var CheckPW = xfa.host.response("Password required", "Comments", "", 1);
if (CheckPW == "123"){
form1.Page1.Office.presence = "visible";
flag = true;
} else {
xfa.host.messageBox("Wrong Password, please try again!", "",0,0);
}
}
Paul
Views
Replies
Total Likes
Hi Paul,
I copy and paste your code but does not work......Actually the the response warning box freeze on screen!
See my attachment.
Thanks for your help as always
Views
Replies
Total Likes
The BBS software adds in extra chars so copying and pasting from this app is never a good thing to do. I modified your form and it is working now.
Paul
Views
Replies
Total Likes
Thanks Paul,
Your code works perfect!
One more thing, is it possible for the user if change mind when click's the cancel or the window(x) close button to exit from the warning pop-up window without to go into Comments field?
Now you have to enter password...
Thanks again for all your help
Views
Replies
Total Likes
How about this one .....
Paul
Views
Replies
Total Likes
Paul,
I don't know all of us what we'll do without your help!
You are always there when we need you!
THANKS AGAIN
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies