Submit form conditionally based on radio button selection
Hello,
I am trying to write a script that will submit a form to a specific email address based on which radio button is selected. I found some code for an if/else if setup, but it isn't working. I have three choices in my buttons, but it's only picking up the first email address and ignoring the variable. Also, I am trying to use cSubmitAs in order to submit as a PDF but it just appended cSubmitAs to the end of the email address, so I took it out (so bonus points to the person who helps there). Here's what I have so far:
var nCounty = this.getField("County").value;
if( nCounty = "County1" ) event.value = this.submitForm(
"mailto:jsmith@corpnet.org"
);
else if( nCounty = "County2" ) event.value = this.submitForm(
"mailto:joe.smith@corpcom.org"
);
else if( nCounty = "County3" ) event.value = this.submitForm(
"mailto:jane@corporg.org"
);
I'm trying to teach myself code but am having trouble understanding some of the basics because I can only find information in small chunks.
Any help would be amazing! Thanks ;0)
Meghan