Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

E-mail sumbit button based on drop down choice

Avatar

Former Community Member
I would like my button to submit to my for to an e-mail address depending on which name is selected from a drop down menu (the drop down menu name: CSR). There are 5 possible names in the drop down menu (BA, KC, GH, NR and MR).



I know how to create an e-mail submit button on it's own, but just can't figure out how to have it select the e-mail address based on the drop down choice. Any suggestions?



Thanks!
4 Replies

Avatar

Former Community Member
Sharon



I'm new to the Designer so, unable to answer your question.



But, hopefully you or someone will answer mine.



How can I designate (assign) name to the XML file that gets sent?



Thanks.




Avatar

Level 5
Instead of standard Email button I would choose a regular button and will have following JS code added in Click event.........



var eadd = "";

var subj = "Subject text";

var ebody = "Email Body text goes here";



if (dd.rawValue == "BA") {

eadd = "BA@Company.com";

}

if (dd.rawValue == "KC") {

eadd = "KC@Company.com";

}

if (dd.rawValue == "GH") {

eadd = "GH@Company.com";

}



event.target.submitForm({cURL:"mailto:"+eadd+"?subject="+subj+"&body="+ebody,cSubmitAs:"XML",cCharset:"utf-8"});



//Replace XML with PDF if you wish to attach PDF document rather than XML

//this is just an example for you to start working on you may still have to work on other validations

Avatar

Former Community Member
Thanks so much for the great start. I never would have figured that out without your help.



I've followed your path and integrated my own information with the code above. However, when I click on the button, nothing happens. I can click (no error messages), but no action follows. Any ideas?

Avatar

Level 5
JavaScript is picky and case sensitive. I suspect some silly mistakes. Those have to be resolved and are part of learning curve. If you want me take a look just shoot me an email at "meetsekharv AT yahoo.com" with your template attached.