Expand my Community achievements bar.

SOLVED

Interactive Dialogue Box

Avatar

Level 3

Hi,

     Is it possible to develope an interactive dialogue box in livecycle designer from whci we can select values? e.g. for a particular text field, if I enter 2 alphabets and click a search button, then it should display the resulting options in a small pop-up window from which any one value can be slected and that selected value appears in that text field.

     Please let me know if this is feasible in Livecycle Designer ES.

Regards,

Nakul

1 Accepted Solution

Avatar

Correct answer by
Level 10

Definitely it is possible. See the image for a sample. We have done a similar dialog as you mentioned.

I have attached a scripting guide. See the explanation on the execDialog method available on page94.

Nith

View solution in original post

20 Replies

Avatar

Correct answer by
Level 10

Definitely it is possible. See the image for a sample. We have done a similar dialog as you mentioned.

I have attached a scripting guide. See the explanation on the execDialog method available on page94.

Nith

Avatar

Level 3

Hi Nith,

I think this is what I was looking for. Thanks a lot for your help. May bother you again, if I face any problems while deveoping. Once again thanks a lot.

Regards,

Nakul

Avatar

Level 3

Hi Nith,

Whatever info you gave me is working perfectly for hardcoded values. Currently, I am using a list box in the dialog box and I am able to pass the selected value to a field and siaply it in the form. However, in my case, I dont have hardcoded values. The values vary depending upon the entry made by the user and those values need to be loaded in the list box. In the examples given, the list box is loaded using the code:

dialog.load( {

       subl

: {"Acrobat Professional": 1,"Acrobat Standard": 2}

} )

I am trying to include a for loop to populate the values but it shows errors. Can I load the elements in the list box from the main form itself if it doesn't work here?

I have also attached the form that I used for testing.

Regards,

Nakul

Avatar

Level 4

The list passed into the "dialog.load" function is an ordinary, generic JavaScript Object.  You can write code to build this object before passing it into the load function.

var myList = {};

myList.apples = -1;

myList."Pear" = -1;

for(var i=0;i<2;i++)

  myList["sel" + i] = -1;

dialog.load({"subl":myList});

The myList variable can be build outside of the dialog object just before the "app.execDialog()" is called, and it can be built dynamically while the dialog is opened for changing the list on the fly.

Check out this tool, it will make writing the dialogs much easier:

http://www.windjack.com/products/acrodialogs.html

And down load a more recent Acrobat JavaScript reference (link below)

 

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 3

Thanks a lot Thom. I this it should work now. Also thanks a lot for all the precious links as its really hard to get ur hands onto some ADOBE material.

Regards,

Nakul

Avatar

Level 3

Hi Thom,

Your solution was exactly what I was looking for. However I have one more problem in this. Whenever I pass a string value to the element in the list, it always passes"1". I tried passing the string values in an array as well. Is there any specific way the string values need to be passed?

Regards,

Nakul

Avatar

Level 4

I'm not sure exactly what you mean.  But, the list passed into the "dialog.load()" fucntion is a JavaScript object where the member names are the list items and the member values are just an indicator that tells Acrobat which item is active.  This is not an index value or an export value.  It's more of a true/false kind of thing.  You add a new item to the list by adding a new element to the object.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 3

Thanks a lot Thom for the response.

Actually, I am using a list box in the dialog. So, for each item I needed a text and a value. However, I figured out that some time back. Thanks a lot for all your help!!!

Regards,

Nakul

Avatar

Level 4

There is an easy way to get a value for your list box item. Create a master

object that maps text to a value.

Cheers,

Thom Parker

WindJack Solutions, Inc

www.windjack.com

www.pdfscripting.com

Avatar

Level 3

Hi Thom,

I am faced with yet another problem in the Dialog Box. The Title of the Dialog Box always shows "JavaScript Window". Is there a way to change that? In code that you have given me, I see that under Description, we are assigning a name to the dialog box. However, I dont see that name appearing anywhere in any of the dialog boxes. is that part of the code obsolete or something?

Thanks a lot in advance.

Regards,

Nakul

Avatar

Level 4

If a dialog is run from a non-privileged context Acrobat is very keen on letting the user know that it's a JavaScript popup dialog so they don't get spooffed.  You get the same thing with the alert boxes.  The only way to get your title back and to remove the red JavaScript Warning message at the bottom of the dialog is to run the dialog from a trusted function.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 10

Does anyone else feel this confuses form fillers? Adobe puts this message in but doesn't explain what it is to the end user.

I've had quite a few comments about it.

Does it go away if a pdf is certified?

Avatar

Level 4

Yes, it goes away if the PDF is certified and the user has the digital

certificate on their system. The message is only displayed when the code is

run from a non-privileged context. Same for all the standard alert boxes.

Thom Parker

WindJack Solutions, Inc

www.windjack.com

www.pdfscripting.com

Avatar

Level 1

I have a quick question WRT custom dialog boxes: I used what you had here and managed to create some pretty slick dialog boxes - Thanks! What I need to do is call the dialog box from a click event of a text field. It all works fine, except that the value that the user selects does not show in the text field until after the field is exited, which is no good for our purposes! After a ton of googling, I tried xfa.event.change and xfa.event.newtext, but these don't seem to work with custom dialog boxes.

So, what I need to do from the CLICK event is something like:

this.rawValue = this.getUserSelection();

where getUserSelection() calls a custom dialog box and returns the value that the user selected. The rawValue needs to be updated immediately on return, not after the user clicks out of the field.

BTW, if I instead do:

var testVar =  this.getUserSelection();

app.alert(testVar);

this.rawValue = testVar;

then the alert box shows the new entry that the user selected, but the field does not show it until after the user has clicked out of the field. Not intuitive at all. Help?!

Cheers,

Marty.

Avatar

Level 4

Hello Marty,

We only answer questions on the forums. However you've hit on an

interesting issue. The problem is that when the focus is on the text box

it's in edit mode. It's only displaying the value interactively entered by

the user, or as a consequence of the change event. What you need to do is

force the focus off of the text box in code. You can do a little trick

where you bounce it to a tiny transparent field, which then bounds the focus

back so it doesn't look like the focus changed.

Cheers,

Thom Parker

WindJack Solutions, Inc

www.windjack.com

www.pdfscripting.com

Avatar

Level 1

Thanks Thom,

Not sure what you mean by "We only answer questions on the forums."?? Do you mean "about the forum"? Anyway, I managed to get it by simply calling xfa.host.setFocus(); with no parameters, which leaves the focus out of the field. This works OK on this form.

Thanks for your help - I was beating my head on that one...

Cheers,

Marty.

Avatar

Level 4

Ha, Ha,  I misinterpreted the email.  We get private requests for help all the time.  We're a consulting company and I'm not allowed to provide free help unless it's public. I didn't catch that this one was a forum response.  Sorry. 

Anyway, very clever work around.   The documentation doesn't say anything about how the function works without an input value, and it implies the input is required.  How did you figure it out?  It seems like this is performing the equivelant of a field value commit.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 1

Oh, I can't really take credit for "finding it out" - the wonderful world of google found documentation that states:

"When the param1 argument is omitted or null, setFocus performs a clear focus operation. If any form object has the input focus, the focus is removed from that object and any pending edits in that object are committed..."

This is at: http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=001379.html

Cheers,

Marty.

Avatar

Level 4

Of course, the new interactive HTML docs.  I'm looking at the

old PDF stuff.  Which begs the question, does this work on older verisions?

Cheers

Avatar

Level 1

Yeah,

I was fighting and fighting with the same issue on Windows 7. It seems to me somebody helped me out here BUT it shouldn't be that way.

I now have two different passwords set up on my two machines because I don't know of anyway to change my CS Live credentials within the programs. Now when I switch machines, I have to go to acrobat.com and change my password to the one CS5 likes on that computer.

Adobe must build out the credentials in a more user friendly manner ASAP in a free update.

bottom line, I had to change the password on my account online to the one it was when I set up CS5 on that computer...It seems it is unchangeable in Photoshop.

Thanks,

Brian