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

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:
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
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
AcrobatUsers.com >> User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in