Expand my Community achievements bar.

Hide Button / Lock Fields after form is completed

Avatar

Level 3

I have created a dynamic form with a "regular" button that submits the completed form via email using the following click event script:

var oDoc = event.target;

oDoc.mailDoc({

bUI: true,

cTo: emailaddress,

cCc: emailaddress,

cSubject: "here",

cMsg: "here"

});

From here, I need to Hide/Lock the 'submit' "regular" button, and lock all editable fields once the form is completed and sent.

The goal is that once the form is filled out and emailed, recipients will have a "read only" report.

I'm using LC Designer 8.0 to create this form.  I also have Acrobat 8 Pro.

Any advice given is greatly appreciated.

Thanks.

12 Replies

Avatar

Level 3

To clarify, the PDF form is completed by clicking on the button I've scripted to generate an email.

The completed form is not saved by the user filling out the form.

I need the "regular" button that is used to generate the email to lock or hide itself as well as lock all fields making the form read only for those that receive the email.

Again, thanks in advance for any advice given.

Avatar

Level 10

If it's emailing you back the pdf, it has to save first. If it's not going to be saved, there's not much point in locking the fields, is there?

The link I supplied has Paul's sample showing how to lock all fields.

If the pdf is being emailed back to you, then you could add a "save-as" prompt.

At the end your script, you can set the button to readOnly or set it's presence to hidden.

So you'd script the lock all fields, then your email script, then hide the button.

Unless I'm missing what you mean.

Avatar

Level 3

The blank form, will already be available to the users that will be filling it out through a shared drive.

They will fill it out and submit it via the script button but will not save the completed form (as they have no need for keeping them), once management receives it they will review the report and they will save it for documentation purposes.

We've already tested this in a beta version of the form and this much works fine.

What we'd like to do is have the completed PDF that is generated in the email, but not yet saved anywhere else, effectively be a "read only" document.

This is where my questions regarding hiding the button and locking the fields comes in.

Now with all this said, would scripting a CLICK event  (lock fields > email doc > hide button) accomplish this?

Thanks for your patience and advice.

Avatar

Level 10

Yeah, scripting to the Click event will work.

Avatar

Level 3

Ok scripting for emailing and hidding the button works, but locking fields does not.

What are some alternatives?  A script for making the Fields "read only"?  Script for flattening the fields?

Note: LC Designer 8 and Acrobat Pro 8 are the two programs I'm using.  Form was created primarily in LC.

Thanks.

Avatar

Level 7

Is making the form part of a workflow an option for you? You could have the form print to the Adobe PDF printer to flatten the fields and then submit the flattened PDF.

Avatar

Level 3

After picking at it for a while the solutions that accomplished my goals were as follows:

Click Event:

button.presense = "invisible";  \\ hides the button

field1.access = "readOnly";

field2.access = "readOnly"; \\ repeat for all fields

var oDoc = event.target;

oDoc.mailDoc({

bUI: true,

cTo: emailaddress,

cCc: emailaddress,

cSubject: "here",

cMsg: "here"

}); \\ script for emailing the form

Thanks for the input.

Avatar

Level 10

Hmm...odd - Paul's script should have worked for you.

Maybe you didn't put the script object in the correct spot?

Glad you got it going anyway!

Avatar

Level 1

Hi Jono

I know this is a really old thread but Im desperately trying to achieve the same thing for a client who is getting very impatient!

Im using Acrobat DC and trying to add the code to as a Javascript action to a button, but I keep getting syntax errors, Im not code savvy but is there anyway you can help please?

Many thanks!

Avatar

Level 10

If you are using Acrobat, and not LiveCycle Designer, you'll need a different script. I'd check over in the Acrobat forums.

Avatar

Level 1

Thanks for your reply Jono, yes only using Acrobat but having trouble finding any proper/correct information