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

"Attach files" button for form that works in Reader before submitting via "Submit" button

brianscottoliver
Registered: Oct 29 2007
Posts: 6

I would like to add a button to a form created in Livecycle that will allow my low/no tech end users to be able to press and attach files to the form even in Reader before the form is submitted via the "Submit by E-mail" button. Any suggestions, previous post answering this question is missing the instructions link

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
For an XFA Form this can only be done with the "doc.importDataobject()" function. Look it up in the Acrobat JavaScript Reference. There are some restrictions. For example, Reader cannot embed a file into a PDF, unless the file has "Embedding Rights". Embedding rights are only available through the Live Cycle Rights Enabling Server.

Also, from the XFA JavaScript context, the "Doc" object is acquired with "event.target", so the code in the button's click event would look somthing like this.

event.target.importDataObject({cName:"theName"});

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

excelgeek
Registered: Nov 3 2007
Posts: 44
How would you do this using a submit button using the PDF Format instead of using FDF? Plus doing it in Acrobat 8.0 pro instead of LiveCycle?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There is a mechisim for this in regular PDF submissions. In fact it's been around for quite a while.

1. Add a text field to a PDF.
2. Name it "SubmitFiles"
2. Set the "Field is used for file selection" Option
3. Add this script to a mouse down action on the field, or to the submit button, just make sure that the script is called before the submit happens.

var f = this.getField("SubmitFiles");f.browseForFileToSubmit();

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

grandxprix
Registered: Nov 14 2007
Posts: 63
For Pdf Pro-----End users attaching a file to a pdf via submit, does the submit button function have to email submit or can it be a web submit
GWilson53
Registered: Sep 2 2008
Posts: 11
I am a new user of adobe tools. I am using Acrobat 8 Pro. I orignally designed the form using LiveCycle Designer but discovered that it would not work in my environment (users with Reader need to use my form).
Redisigned the form in Acrobat 8 Pro. I have it working with the exception of the file attachment process. I used your suggestion to use a text file that had been 'set for file seletion' and the script for browseForFileToSubmit(). When I click in the field, I get the expected file selection box. I select the file I want and the file selection box goes away (as expected). The text field associated with this script remains empty until I remove focus from it (i.e. click on another field). I can deal with this but the bigger problem is that I do not have the file attached to the pdf when I press the submit button later in the process. The submit button is an email submit and works fine to send the pdf form (but there is no attachment). It will not even work when I fill the form in using Acrobat 8 Pro.
Any ideas about what I am doing wrong?
Thanks
dk3dknight
Registered: Jan 22 2008
Posts: 136
Small question why did adobe reader have a issue with you not being able to use livecycle?

"Advanced-> Enable Use age Rights in Adobe Reader"or were the users stuck in some extrelly low version of reader?

Just curious.

GWilson53 wrote:
I am a new user of adobe tools. [b]I am using Acrobat 8 Pro. I orignally designed the form using LiveCycle Designer but discovered that it would not work in my environment (users with Reader need to use my form).[/b]
Redisigned the form in Acrobat 8 Pro. I have it working with the exception of the file attachment process. I used your suggestion to use a text file that had been 'set for file seletion' and the script for browseForFileToSubmit(). When I click in the field, I get the expected file selection box. I select the file I want and the file selection box goes away (as expected). The text field associated with this script remains empty until I remove focus from it (i.e. click on another field). I can deal with this but the bigger problem is that I do not have the file attached to the pdf when I press the submit button later in the process. The submit button is an email submit and works fine to send the pdf form (but there is no attachment). It will not even work when I fill the form in using Acrobat 8 Pro.
Any ideas about what I am doing wrong?
Thanks
mbrady
Registered: Sep 26 2008
Posts: 1
I designed a form using Acrobat 8 Professional. I followed the instruction on creating a text field. Unfortunately, the "Field is used for file selection" option is grayed out. How do I enable this option?

Thanks for your help.
dk3dknight
Registered: Jan 22 2008
Posts: 136
mbrady wrote:
I designed a form using Acrobat 8 Professional. I followed the instruction on creating a text field. Unfortunately, the "Field is used for file selection" option is grayed out. How do I enable this option?Thanks for your help.
Im sorry mbrady, um you posted in the wrong forum. This is for LiveCycle not adobe Acrobat, they create forms differently and have different user interfaces.

This is a link to the forums dealing with forms created in Adobe Acrobat.
http://www.acrobatusers.com/forums/aucbb/viewforum.php?id=22

I fear that the differences between the two programs will only waste your time with incorrect or invalid answers.

Have a nice day :)
humayoo
Registered: May 18 2009
Posts: 12
i have three field text1,text2,text3.text1 and text2 are plain text.text3 is rich text format.

now i want to export the text3 data only as Rich text format without losing its format.

is there any idea or solution or way to solve this problem?

thanks
Humayoo
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Humayoo, This forum was really the wrong place to ask this particular question. I answered it where you posted the original question

http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=21446

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

EF11
Registered: Jun 4 2010
Posts: 12
Hi, I am trying to attach a file to the pdf, using LiveCycle 8, but am not having any luck so far. I tried your example above, but it does not append the file to the end of my document. Can you help me with this? Thank you in advance!
EF11
Registered: Jun 4 2010
Posts: 12
If anyone else is ever looking for a way to attach a file to a LiveCycle form, this is the solution that worked for me:

var myDoc = event.target;
myDoc.importDataObject({cName: "a file"});