Copy link to clipboard
Copied
Hello,
I have a form that I want to send VIA a submit button to a variable email address based off of an earlier selection in a radio button.
I am new to JavaScript, This is what I have so far, although I know this is not correct.
this.submitForm(
"mailto:mm@mycom.com?" +
"&cc=123@abc.com" +
"&subject= [ID CODE] + "[Customer Name]"
);
cSubmitAs:"PDF"
});
What I need to happen is below.
My form has a radio selection button with 5 options
If option 1 is selected then email 1@abc.com + CC anna@abc.com
If option 2 is selected then email 2@abc.com + CC anna@abc.com
and so on...
for the subject line I want it to pull 2 fields from the form Client Number + Client Name after Template Submission
For Example Client Number is 1234 and name is Joe Smith
The subject should read Template Submission 1234 - Joe Smith
And lastly I need the attachment of the form to be PDF version
Thank you in advance for your expertise!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you, I did locate this on my search but so far have not been successful in executing the javascript. I keep getting Syntax errors that I don't know how to fix.
Copy link to clipboard
Copied
Post the code you're using and we'll help you fix it.
Copy link to clipboard
Copied
PS. You should switch to using mailDoc, instead of submitForm. It's more flexible, although it doesn't validate the required fields before submitting the file, if that's something that you rely on...
Copy link to clipboard
Copied
Thank you,
What I have so far which is not complete but is so far the last variation I have tried is:
this.submitForm(
"mailto:mm@mycom.com?" +
"&cc=123@abc.com" +
"&subject= [ID CODE] + "[Customer Name]"
);
cSubmitAs:"PDF"
});
I did also attempt an if statement but I have since deleted that so I can't post it however, it failed.
I do use a lot of form validations within this form, but that is great information in the future when I do not need the validations.
I sincerely appreciate your help!
Copy link to clipboard
Copied
Ah I found it!
this.submitForm(
"mailto:mm@mycom.com?" +
"&cc=123@abc.com" +
"&subject= [ID CODE] + "[Customer Name]"
);
cSubmitAs:"PDF"
});
Copy link to clipboard
Copied
if ( CE Team == "CE 1" )
this.submitForm(
"mailto:mm@mycom.com?" +
"&cc=123@abc.com" +
"&subject= [ID CODE] + "[Customer Name]"
);
cSubmitAs:"PDF"
});
Copy link to clipboard
Copied
I have gotten to this point so far
var cMailSelect = this.getField("CE Team").value; if(cMailSelect == "CE 1")this.submitForm ("mailto:1@abc.com;" +
"anna@abc.com")
However this puts "anna" in the to section not the CC section as I want.
Copy link to clipboard
Copied
Right, because that's what you told it to do. Read the documentation of the mailto syntax to learn how to specify a CC address, a subject line, etc.: https://yoast.com/developer-blog/guide-mailto-links/
Copy link to clipboard
Copied
Thanks for your assistnace I was able to get it correct yesterday for all the areas I needed !