Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2007-11-12 16:25:15

NancyM
Member
Registered: 2007-04-24
Posts: 12

alert box with Yes & No buttons?

I am working in LiveCycle 7.0 and have created an alert box for my dymanic form that appears on exit of a text field.

example

app.alert("Is this correct?",2,2);

What I need to do upon the answer is:

if Yes is clicked some text and drop down fields need to be filled in.
if No these same fields need to be read only.


My Product Information:
LiveCycle Designer Pro 7 / Windows

Offline

 

#2 2007-11-29 13:51:27

sconforms
Member

Registered: 2007-07-10
Posts: 31

Re: alert box with Yes & No buttons?

I would suggest you use the

xfa.host.messageBox("message", icon, buttons)

method where the icon parameter is 0 (error) to 3 (status) and the buttons parameter is 0 (OK), 1 (OK, cancel), 2 (yes, no), 3 (yes, no, cancel).

The method then returns an integer indicating which button was pressed: 1 (OK), 2 (cancel), 3 (no) or 4 (yes).

You would then have an IF statement like this:

Code:

var choice = xfa.host.messageBox("message", 2, 2);

if (choice == 4)
    // fill-in fields: myField.rawValue = "default";
else
    // set fields to read-only using the access property: myField.access = "readOnly";

Offline

 

#3 2007-12-03 12:28:05

NancyM
Member
Registered: 2007-04-24
Posts: 12

Re: alert box with Yes & No buttons?

When I added the following to the exit event of the prior textBox field. I get this console message (see below).

var choice = xfa.host.messageBox("Will returns be filed?",2,2)
if (choice == 3)///answer no
{
_940.access = "readOnly";
}
else
{
_940.rawValue = "";//Allowing input into testBox filed
}

Console message

GeneralError: Operation failed.
XFAObject.messageBox:1:XFA:F[0].P1[0].CityStateZip[0]:exit
Argument mismatch in property or function argument

When I change to app.alert the box appears and when answered yes input to the textField is allowed and I can tab to next field.  But when no is the answer, I am able to input into the field but not tab out.  I have found that if I setFocus to another textField and then try to go back to the field that was set to readOnly, it works.

var choice = app.alert("Will returns be filed?",2,2)
if (choice == 3)///answer no
{
_940.access = "readOnly";
xfa.host.setFocus("Dep940M");
}
else
{
_940.rawValue = "";
}

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in