Expand my Community achievements bar.

SOLVED

Save form button not working

Avatar

Former Community Member

Hi

Not sure what i'm doing wrong here

I got a standard button - named it save_form_button and attached this code (from livecycle scripting reference) to the click event

App.executeMenuItem("SaveAs");

var mydoc = event.target;

mydoc.saveAs();

am i doing something wrong cause it does not work in preview or when pdf is opened in acrobat

just trying to get a "in form" version of the menu save - with the client specifying the path and name etc manually

anyone got any ideas - or had this working in the past

thanks

1 Accepted Solution

Avatar

Correct answer by
Level 2

indeed you have to use only the line :

app.execMenuItem("SaveAs");

assuming that you are using either designer 8.0 or 8.2 version.

after this make sure that your form is saved as "dynamic"

go to form properties and make sure under Default and Preview sections you have Dynamic option selected.

Lastly make sure that if you are using any variables in your form, then they have some initial value at the time of form save.

If any such object is instantiated without any initial value, your SAVE AS will not work.

if you run the form in ACROBAT PRO and NOT READER, then hitting Ctrl + J will open run time debugger, which will show you which part of script is not running, at the click of the button.

~Sid

View solution in original post

4 Replies

Avatar

Level 10

You just need

app.execMenuItem("SaveAs");

Remove the other two lines of code. They work only if your form is a certified form.

Thanks

Srini

Avatar

Former Community Member

hi

thanks. i changed the code as you suggested but it still does nothing when clicked?

do i need to change some kind of form security setting perhaps?

thanks

Avatar

Correct answer by
Level 2

indeed you have to use only the line :

app.execMenuItem("SaveAs");

assuming that you are using either designer 8.0 or 8.2 version.

after this make sure that your form is saved as "dynamic"

go to form properties and make sure under Default and Preview sections you have Dynamic option selected.

Lastly make sure that if you are using any variables in your form, then they have some initial value at the time of form save.

If any such object is instantiated without any initial value, your SAVE AS will not work.

if you run the form in ACROBAT PRO and NOT READER, then hitting Ctrl + J will open run time debugger, which will show you which part of script is not running, at the click of the button.

~Sid

Avatar

Former Community Member

thanks heaps - it was a variable causing the problem