Expand my Community achievements bar.

How to change the target attribute by using JavaScript?

Avatar

Former Community Member
Hello everybody,

i have (at least i thought i had) a simple problem:

imagine a form, a textbox to enter an email address and a command to send an email to the specified recipient (the email address in the textbox).

this is the last version of my coding:



//name of the button is "cmdSendMail"

cmdSendMail.getElement("event").getElement("submit").setAttribute("target", txtEmail.rawValue);



another (older version):
cmdSendMail.#event.#submit.target = txtEmail.rawValue;

Would be very nice if anyone has an idea/solution to my problem...

Thanks a lot
5 Replies

Avatar

Former Community Member
Instead of a submit button, use a regular button.

With its click-event, use something like:






event.target.submitForm({

cURL: "mailto:"+ txtEmail.rawValue,

bEmpty: true, // post all fields (true), or do not post all fields (false)

cSubmitAs: "XDP", // format: 'XDP', 'XML', 'PDF'

// Note: PDF requires the form to be reader-extended in order to work with Adobe Reader

cCharset: "utf-8" // 'utf-8', 'utf-16'

});



Avatar

Former Community Member
Steve,



That's nice to see all of the parameters shown nicely. Thanks.



Is it possible to rename the attached PDF. Would it even be possible to do a SAVEAS() to a different pdf filename, then specify that attached PDF?

Avatar

Former Community Member
I think, its impossible to submit the form using a custom filename.

At least if it would be possible, it's an undocumented feature. You may want to have a look at:
JavaScript for Acrobat API Reference, Version 8 (PDF, 7.5 MByte) (pages 345+).



You may want to use a custom subject for the user to be able to quickly identify the e-mail:




cURL: "mailto:"+ txtEmail.rawValue +"?subject=myPrettyCustomSubject"


Avatar

Former Community Member
Steve,



Since I do all of my development in Livecycle (and not acrobat forms), am I still able to use the javascript SDK? I'm not sure where the SDK fits in, is there any other documentation explaining this.

Avatar

Former Community Member
Some (a lot?) of the Acrobat JS properties and methods also work with LiveCycle forms. I doubt, there's decent documentation to detail which properties and methods work with LiveCycle and which don't. At least, if there is such a document, I haven't had the pleasure browsing it. :-)