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

Filename and paths in Live Cycle CS4

Stargazer
Registered: Nov 30 2009
Posts: 8

I have been working with live cycle changing over our forms from word documents to PDF forms.

Everything I have done has just been through trial and error. For the most part that has been just fine.

Now I need to be able to have the filename and path with the forms are saved like you can in word. I know nothing about java script and really have no clue where to start.

Is the a preset function that I can add like the fields in Live Cycle or is there something else I need to do.

Any guidence anyone can give me would sure be helpful as I have many forms my company wants to move to PDF forms and I really like using live cycle.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi Stargazer,

the thing is, that Acrobat/Reader always uses the original file name in the save dialog.
A feature as in Word, where the filename is autoamtically generated by the headline isn't available from default.

But, you can rename the files with some scripts.

This needs some more efford to realize.
First you need a folder level script (security related) on every PC that should use the functions.
This is often only possible in a closed enviroment (company network).

The script will look so.
// Function to save File var AUC_SaveAs = app.trustedFunction(function(doc){app.beginPriv();var AUC_SaveAsTarget = SaveAsTarget;doc.saveAs(AUC_SaveAsTarget);app.endPriv();});

In your form you then need some scripts to generate a file name from one or more form fields and to call the function from the folder level script.

This script generates a new file name and uses the current path to save the file.
; A variable to check file name latervar CheckFileName = xfa.resolveNode("form1.#pageSet.Page1.FileParameters.ThisFileName").rawValue ; The current pathvar Source = xfa.resolveNode("form1.#pageSet.Page1.FileParameters.CurrentPath").rawValue ; A variable we use in the filename; Replace all spaces with underlines to avoid raise errors during saving.var CustomerInfo = Replace(xfa.resolveNode("form1.#subform.CustomerName").rawValue, " ", "_") ; Create a time stamp for the new file (optional)var TimeID = Num2Date(date(), "DD-MM-YYYY") ; Variable with the new save targetvar NewTarget = "" ; This functions checks the current file name. If it is not the correct file name no new file will be saved.if (CheckFileName == "AUC_SaveAs.pdf") thenNewTarget = Concat(Source, "AUC_SaveAs", "_", CustomerInfo, "_", TimeID, ".pdf")$.rawValue = NewTargetelse$.rawValue = xfa.resolveNode("form1.#pageSet.Page1.FileParameters.FullSource").rawValueendif

A button with another script fires the final action 'save as'.
//Get the value of the field with the current file namevar CheckFileName = xfa.resolveNode("form1.#pageSet.Page1.FileParameters.ThisFileName").rawValue /*Create a variable with the current file name.

If the filename matches with the file name in the if expression

save the file under the predefinded destination and with the

new file name.

*/
if (CheckFileName == "AUC_SaveAs.pdf"){//A variable for the Folder Level ScriptSaveAsTarget = xfa.resolveNode("form1.#pageSet.Page1.FileParameters.TargetCurrentPath").rawValue; event.target.AUC_SaveAs(event.target); // Show message to inform the user, where the new file was saved.xfa.host.messageBox("File has beed saved under:\r\r" + SaveAsTarget, "File Saved", 3, 0);xfa.form.execInitialize();}else{// Open the 'Save As' dialog to let the user choose the target and filename.app.execMenuItem("SaveAs");}

If this is new to you, it might be looking extremely complicated, but it isn't that much.
To give you a better start you can use my sample form and folder level script.

[url=https://acrobat.com/#d=XEIx2licld4rf6pUZnBeNw]Example Form[/url]
[url=https://acrobat.com/#d=H5LQ4bHaHyxq5ZnS-VyGCQ]Folder Level Script[/url]

Good luck

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Stargazer
Registered: Nov 30 2009
Posts: 8
Thank you so much for your help! I will try to look into doing this but it sound like it is WAY over my head.

I have created a intranet for our company and am putting commonly used forms there. We have used word documents in the past and sometimes they have gotten accidentally changed since they just word documents.

I have been changing those over to forms using Live Cycle. And have managed to figure everything out up to this point.

For document management we have used the filename and path option in word as to where the documents are saved when completed so we can find them later from the printed document if needed.

I was hoping there was something easy in Live Cycle that would do the same thing.

I have the form created I just dont have any idea how or where I would apply the scripting.

Maybe I should just make it part of the form that they will have to place the path in in document itself when they fill it out. It would be an extra step or two and I am not sure they will like that.

They really like the form and say it is much easier than the word forms but they really want a path where the filled out form is saved.....

If you have any other suggestions for me it would be greatly appreciated.

I am a learn by using type of person and I really dont understand the scripting thing or how exactly to use it.

I dont mean to take up your time but any help you can give me would be great!
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Maybe you missed the two samples "Example Form & Folder Level Script" I attached to my first answer.With these two files you can do the things you described.
All the scripts above are just within the files, so you easily check out where they are located and how they work.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Stargazer
Registered: Nov 30 2009
Posts: 8
I renamed the txt file to .js and put in the Location of the javascripts.

I am not sure just what I am suppose to do with the other file you sent me.

I am sorry that I dont understand.

I have just been creating simple forms and have never really gotten into anything where I have to edit the javascript in Live Cycle.

Can you give me any more help?

I really appreciate the help you have given me....I am still learning all of this. As I said I am a learn as I use type so sometimes I am a little slow on the uptake.

So if you could give me a little more guidance....

Cheryl