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.

How can I change the submit mailto adress(es) dynamically, based on a dropdown?

Avatar

Former Community Member
How can I change the submit mailto adress(es) dynamically, based on a dropdown?



I need to make a form with an dropdownbox.

The value selected will set the mailto value.

Other textfields have to set the cc value.



How can I do this?
23 Replies

Avatar

Former Community Member
If you post your form to livecycle8@gmail.com I will give it a try.

Avatar

Former Community Member
Am also looking for this solution... does anybody have this?



====

console.println("rawVal " + xfa.form.xx.LeavePage.btnSubmitToManager.rawValue);

console.println("val " + xfa.form.xx.LeavePage.btnSubmitToManager.value);

console.println("name " + xfa.form.xx.LeavePage.btnSubmitToManager.name);

=====



xfa.form.xx.LeavePage.btnSubmitToManager.value returns an [XFAObject]

how can this be used? looped through it and found nothing?



====



In the XML Source view, we are trying to change the "target" attribute of the element, but still can't find anything that resembels a solution

Avatar

Former Community Member
So I would use a Button object (I called mine Mail) then make it a submit button. In the submit tab set the submit url to be mailto:emailaddress. Now when you want to change it use this javascript code:



app.alert(Mail.event__click.submit.target);

Mail.event__click.submit.target = "mailto:newEmailAddess@company.com";

app.alert(Mail.event__click.submit.target);



Note that the app.alert statements are for debugging only.

Avatar

Former Community Member
Excellent... wat a legend :)

nice one!

thank you!

Avatar

Former Community Member
The solution works for one submit button.



When one has a number of submit buttons on the page.. strange results that cannot be explained happen!



Am still digging and will post some concrete results when done.

Avatar

Former Community Member
<a href="http://www.glimmerrocks.com/" <br />title="Engagement Rings" target="_blank">Engagement Rings</a> <br />- Find glittering engagement ring, engagement rings, cheap engagement rings, discount engagement rings, designer engagement rings and customized engagement rings at our certified online jewelry store.

Avatar

Level 2
hi



i am trying to accomplish a similar thing with no results as yet.



i have my button converted to an email submit button. When i make a selection from a dropdown box i would like the dropdown menu value to become the new mailto: address.



the cc value needs to be a combination of two fields and the form title, is that possible?



the form will be used alot and would save a lot of time if they were prepolulated, and i need to send the pdf file as a pdf not an xml.



there is also just one submit button on the form.



this should be a common problem as many forms will need to be sent to different offices depending on the info within the form.



this was the only thread on this topic that i could find



ibrahim

Avatar

Former Community Member
Yes it is possible .....do not use a mailto button ...use a submit button ....you can set the submit url to a mailto url where you can set all parts of the mail message and you can set what is to be submitted to whatever you want. Just do a google search on the net for mailto and you will see how to set the url to what you want.



Now to set the command dynamically you can use this command:



ButtonName.event__click.submit.target

Avatar

Former Community Member
Mr. Guerette, the help you give in these forums is astounding. I have been reading your threads on linking a mailto email address to the value from a dropdown list, but I must admit, I am too much of a beginner to make it work yet. I have taken your advice and placed a button in the form, made it a submit and used a placeholder mailto address. My question now is, where do I place the javascript examples you have given? If my drop down is named "EmailAddress", how do I get its value into the mailto?

Avatar

Former Community Member
On the exit event of the dropdown list you woudl add the code I mentioned earlier. When the user leaves that field the value of the DD would be tested, the email address would be updated and then you can programmatically hit the submit or have the user do it on his/her own.



Paul

Avatar

Former Community Member
ah, okay, on the exit event. That makes sense. I appreciate your help.

Avatar

Level 2
i have done my best to follow the instructions you guys kindly give



i have added some fake email addresses to a drop down list (or DDL). and this is what i have got



ftp://mujahid.dnsdojo.net/publicfolder/dropdown_email.xdp



if it can be fixed i will leave it in the public folder for others to download and copy

Avatar

Former Community Member
I've done everything suggested previously and when the email is generated, it still places the bogus email address I added in the mailto when I placed the button. Do I need to remove the





section that was generated automatically when I placed the button?

Avatar

Former Community Member
Send your form to livecycle8@gmail.com and I will have a look

Avatar

Former Community Member
Is there a way to execute the EmailButton through code? I have another button that gets clicked and depending on certain criteria it execute the EmailButton



thanks,

Avatar

Former Community Member
Use the command emailbuttonname.execEvent("click");

Avatar

Former Community Member
Are you getting any errors in the java console?