Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

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
1 Reply

Avatar

Former Community Member
You ca try to replace your submit button by a normal button and to put a script like bello on click event:

event.target.submitForm({cURL: "mailto:"+

$record.processDatas.processEmail.value +

"?subject=" + $record.processDatas.processSubject.value ,

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

cSubmitAs: "PDF", // Post PDF format

cCharset: "utf-8"});

Hope this help.