Expand my Community achievements bar.

Javascript for changing file name

Avatar

Level 4

Hi,

Is it possible to programmatically change a form's file name? I got this idea while doing a function in VBA (where this is definitely possible).

I was thinking of something like this:

event.target.documentFileName = textfield1.rawValue;

The context is that I have a non-distributed form that is submitted via email (I programmatically generate default email body, subject, and recipient).  But the user can (and does) save the file name whatever name they want.  Now, my forms "know" if they're submitted or not by looking for a flipped checkbox switch upon initialization.  So I'm hoping to automatically change the file name if the app is "recieved".

So theoretically, this code would be in the form initialize event:

if (submission.rawValue == 1) {

event.target.documentFileName = textfield1.rawValue;

}

But of course, I haven't been able to access the file name.  Any ideas?

1 Reply

Avatar

Level 10

It's possible but you need to use a trusted function which means you need access to every machine that will be using the form so you can install custom acrobat javascript.

http://thelivecycle.blogspot.ca/2009/11/save-form-to-specific-directories-and.html