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

Message box in forms using checkbox

shaklee
Registered: May 13 2008
Posts: 48
Answered

I am creating a form and I when I click on a checkbox a info message will popup. User can click OK for the message box to disappear.

My Product Information:
LiveCycle Designer, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
If you're asking a question, please provide more details about exactly what it is you need to accomplish.

George
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
If you need more than "Yes/No/OK/Cancel" options you wil need to use the "Dialog" object of Acrobat JavaScript, but this might not work with LiveCycle Designer forms.

George Kaiser

shaklee
Registered: May 13 2008
Posts: 48
I am creating a form and I would like to click on a checkbox and a message/info box pops up to give some information to the user.
The user can then click OK or an 'x' to close the box.
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
In the Mouse Up event, you could do something like:

app.alert("Your informational message goes here", 3, 0, "Title goes here");

You can do much the same using the xfa.host.messageBox method. Check the XML Form Object Model Reference for more information.

You'll probably want to first check the value of the check box and only do the message box if the check box is be checked, as opposed to unchecked.

George
shaklee
Registered: May 13 2008
Posts: 48
That worked fine. But I noticed on the windowbox header it says Warning: JavaScript Window. How can I get rid of this?
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi shaklee,

That message is because Adobe considers it a security issue. See this thread for ways to prevent the message-
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=710

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
shaklee
Registered: May 13 2008
Posts: 48
Currently in my form when I click on a checkbox I can get a message box to show up. How do I get an input box to show up so that if the checkbox is clicked the user can enter additional info that will then fill in a text field?
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
You can use the app.response method to prompt the user to make an entry. You'd then validate the input and copy it to a form field. For anything more complicated than the simple app.response, see Dimitri's AcroDialogs product, which makes setting up custom dialogs simple.

George
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
With AcroForms Dialog object, you maybe limited to AcroForms as this object is not listed as working with LiveCycle Designer.

George Kaiser

Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi gkaiseril,

In fact, you can use custom JavaScript dialogs in LiveCycle Designer PDFs, the code can be copied into the scripting area.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
shaklee
Registered: May 13 2008
Posts: 48
How do I get the variable cRtn to always be uppercase in the below Javascript.

var cRtn = app.response("Enter model after info");

Thanks.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You can use the JavaScript "toUpperCase()" method

var cRtn = app.response("Enter model after info").toUpperCase();

George Kaiser

shaklee
Registered: May 13 2008
Posts: 48
Does the app.response command have a list option where the user can select from a list or is it limited to typing in a single command.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Accoriding to the JS API Reference, the "response" method only has a string value return. For anyting else you need to use the Acrobat JavaScirpt Dialog object. This object can support the following elements:

“button” - A push button.
“check_box” - A check box.
“radio” - A radio button.
“list_box” - A list box.
“hier_list_box” - A hierarchical list box.
“static_text” - A static text box.
“edit_text” - An editable text box.
“popup” - A pop-up control.
“ok” - An OK button.
“ok_cancel” - An OK and Cancel Button.
“ok_cancel_other” - An OK, Cancel, and Other button.
“view” - A container for a set controls.
“cluster” - A frame for a set of controls.
“gap” - A place holder.

George Kaiser

shaklee
Registered: May 13 2008
Posts: 48
Sounds great so how would I use it to expand the "Enter Model number" example from the previous emails?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You can get a copy of the documentation for Acrobat JavaScirpt here:

www.adobe.com/devnet/acrobat/javascript.php

After reading about the Dialog object and reviewing the examples you might want to consider purchasing www.windjack.com AcorDialog product www.windjack.com/products/acrodialogs.php

George Kaiser

shaklee
Registered: May 13 2008
Posts: 48
Yes. I am using the Windjack tool as a 15 day demo and that is not working either. I copy the code but can't get it to send to a text field. I'm working with their tech support.
Thanks
shaklee
Registered: May 13 2008
Posts: 48
I used the AcorDialog tool.
I get the following lines of code at the bottom.
When I run this script through Java Console. Pop1 comes back with the selected value from the drop down, but my textfield1 simple comes back as empty.
What am I doing wrong.

// Example Code
JSADMDlg1.MAUSER = "";
if("ok" == JSADMDlg1.DoDialog())
{

console.println("pop1:" + JSADMDlg1.MAUSER);
G.TextField1.rawValue = JSADMDlg1.MAUSER;
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Before you can apply a value from a dialog you need to make sure the code for applying a value by it self is correct. Get rid of all the dialog code for now and replace it with

G.TextField1.rawValue = "Hello";

if this works then you know you have the correct SOM path to the form field. If it doesn't then you need to get this working first.

One you have it working. Then add the dialog code back in and try an explicit string conversion. Like this

// Example CodeJSADMDlg1.MAUSER = "";if("ok" == JSADMDlg1.DoDialog()){ console.println("pop1:" + JSADMDlg1.MAUSER);G.TextField1.rawValue = JSADMDlg1.MAUSER.toString();}

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/]http://www.adobe.com/devnet/acrobat/[/url]

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