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

Question about creating a messege box.

dk3dknight
Registered: Jan 22 2008
Posts: 136
Answered

Is it possible and how would you do it, to after someone hitting a button that submits to a url of a mailto:blah [at] example [dot] com that a small popup or screen appears telling the person it sent and to stop pressing the button.

Ive been having issues of those with outlook just blasting away on the first option of the submit button (default email application) thinking nothing happened. Truth be told Outlook already sent it.

I think you can only guess on how many times the user(s) repeated this step in confusion and I will leave the frustration of my supervisor who received these emails to your imagination.

Also is it possible to get some sorta *ding* noise to go off to grab there attention.

I would prefer a formCalc solution, and javascript only if there is no way to do it with formCalc.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes and no. You can give the user a message by adding a script to the "MouseUp" event on the submit button. But you can't know from JavaScript if the email has really been sent.

The popup would at least slow them down. The message could be something like, "Please check your email program to make sure the message was sent".

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

dk3dknight
Registered: Jan 22 2008
Posts: 136
Update: Never mind I figued it out, thanks for your help you got me thinking and put me on the right track.

An example I put together, of course we wouldn't pull someones yellow cable for dumping 100's of repeat forms into the director of IT's email.
-
xfa.host.messageBox("Your email has been submitted to your mail box, verify that it is in your sent folder and ensure it has been set on its marry way. If you continue to hit the button fully knowing that it sent the first time your yellow cable will be pulled.", 3, 1)
-


Actually that sounds very close to what I wanted..

I just needed something that will show them that,
something happened.

What would the formcalc on the OnMouseEvent look
like?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You've already got it. The message box code you show will work in either FormCalc or JavaScript, doesn't matter. But make sure it's in the "MouseUp" event.

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

dk3dknight
Registered: Jan 22 2008
Posts: 136
Sure did. Its under scripting methods if anyone ever trys to find it again.

Also found the beep...

xfa.host.beep("2")

Thanks Again.
cl5792
Registered: Jul 17 2008
Posts: 53
This does work, except when the user did not fill in all required fields. The message is displayed on the mouseUp event as expexted. but, then the message about required fields is displayed. The fields are highlighted and the form was NOT submitted. Is there a better place to put the message so that it will display after the required fields are successfully validated?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Unfortunately, from code there is no easy way to know if data has actually been submitted or not. Validating required fields is part of the submit process and there is no feedback about this either.

You can use a Submit Script instead of the submit button action. This gives you much greater control over what happens. Validate the fields in code before calling "submitForm".

There is also a preSubmit event. But this event is called before submit validation takes place and it cannot be used to stop a submit, it's only good for modifying data before the submit happens.

If you want greater control over this process the best thing to do is write your own submit script.

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

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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