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

Restrict Button Control

prespares
Registered: Nov 6 2008
Posts: 47
Answered

Hello,

I have a form in which I want to add submit buttons that will route a form between several users. Each time a user clicks the button, the button will become inactive. Can this be done and can some steer me in the right direction for scripting?

Thanks a bunch.

Joe

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I don't think, this will be very handy.

OK, you can create a button with a mailing script (see below) and another action to avoid a second click.
But, what if the mail actions fails in one case or the recipient is not available?
The scripts within a form do not recognize such events!
Then, the user isn't able to use the button again, right?

Script for regular button without any button restrictions
var myDoc = event.target;var address = dropdownList.rawValue; //dropdown list for choosing a recipients mail addressvar sub = "Returned form"; //Your mail subjectvar msgBody = "A message"; //Your mail message myDoc.mailDoc({bUI: false,cTo: address,cSubject: sub,cMsg: msgBody,cSubmitAs: "PDF"});

Script for regular button with button restrictions.
In this case, you will also need another script that controls when the button has to be visible again.
Maybe in the initialize/form ready/layout ready event, but this will also work on the senders side, while reopening the form.

var myDoc = event.target;var address = dropdownList.rawValue; //dropdown list for choosing a recipients mail addressvar sub = "Returned form"; //Your mail subjectvar msgBody = "A message"; //Your mail message myDoc.mailDoc({bUI: false,cTo: address,cSubject: sub,cMsg: msgBody,cSubmitAs: "PDF"});this.presence = "invisible";

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

prespares
Registered: Nov 6 2008
Posts: 47
I see what you mean. This is an internal form, so the chance of it failing are slim but possible.

Where would I add the script?

Joe
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Put the JavaScript into the click event of a regular button (do not use the mail button).

You can find some more information and examples here
http://www.acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs