Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Adding an action to email submit

Avatar

Former Community Member
The scenario is



the user clicks the email submit button

after sending the email the user is redirected to another page.



I have done the following which works but apparently is not quite right as it seems as if two pages are open. I can live with this but would prefer to do something a bit more elegant (and correct).



Here is what I have done:



After the line generated by Designer



---form1.#subform[0].EmailSubmitButton1::mouseDown=FormCalc, client----



I have



xfa.host.gotoURL("http:\\www.xyz.com");



Howard
8 Replies

Avatar

Former Community Member
Try making your custom submit button.




On Click event paste this lines:





var email_address = "mailto:xxx@sxs.net";








// Using later to send the document




var doc = event.target;



// redirecting...




xfa.host.gotoURL("http:/\/\www.google.es");




// 1) if you want to submit the document




doc.submitForm( { cURL: url_address } );




// 2) if you want to send an email




this.resolveNode("#event").submit.target = "mailto:" +

email_address + "?subject='here the subject'&body='here the body'";



b Good Luck!!!



Dan

Avatar

Former Community Member
Dan,



Thanks for trying. The following construct also fails to send the document data.

I truly appreciate your efforts but I don't think it would be worth your time to devote more effort to this.

If I fiddle with the code a bit, the "mailto:xyz@abc.com appears as as URL in the address window of my browser.



Howard



var check = xfa.resolveNode("CheckBox1");

var email_address = "maito:xyz@abc.com";

//Getting the document's target object. It be used later in order

//to send the document.

var doc = event.target;

//Validating the document. You can put here the rest of the

//document's validations.

if(check.rawValue == 0){

app.alert("You must certify that you have read Section 78.");

}else{

//Submit the document. See the documentation for

//more submit options.

doc.submitForm( { cURL: url_address } );

}

Avatar

Former Community Member
Ok, if you want but be careful with misprint in "mailto" you have put "maito" and it wont work.



Check your code thoroughly, because I have tried this example and it works.



Regards...

Avatar

Former Community Member
Yikes. I am embarassed about my poor typing and grateful to you for following up.



Is this something you do for a hobby or do you consulting? If the latter could you send your contact information to me at consult@hlfunk.com



Your script works perfectly.



Howard

Avatar

Former Community Member
Dan,



Your construct works beautifully but I note that is sends an FDF file rather than an XML file. I checked the submit options but they seem to work only with the standard email button and not with the custom button.



Tips?



Howard

Avatar

Former Community Member
I have the solution:



var url_address = "mailto:abc@xyz.com";

var form_format = "XML";

doc.submitForm({ cURL: url_address, cSubmitAs: form_format} );



Many thanks for all of your help.



Howard

Avatar

Former Community Member
It is true and you can send more than one every time.



For example:






var url = "mailto:email@server.com";

var sendAs = "XDP";


// Adding more packets for send.


var packets = new Array("datasets","pdf");

var doc = event.target;



doc.submitForm( { cURL: url, cSubmitAs: sendAs, aPackets: packets } );





If you want to learn more about 'submitForm' method, read this:


AcroJS.pdf (Reference) - page 309 (aprox.)



I don't take part in the Adobe's consulting team, therefore that I do this for hobbie is more probable :P.




Good Luck!

Dan

Avatar

Former Community Member
Danmaster,



Many thanks again. Your notes have been much more helpful than the offical manuals.



Howard