Email submit button pulling export value from multiple dropdowns
Hoping someone can help here, I have very little experience with javascript and I'm not sure if what I'm trying to achieve is possible but here goes.
I have a pdf form with one dropdown with 5 options that when selected each variable brings up a second dropdown (show/hide js no problem). In each of the 5 dropdowns are a list of names with the export value set as the persons email address. The IDs of each dropdown are Level1, Level2 etc and what I'm trying to achieve is having the export value of the selected dropdown box option pull to a submit button that will email the entire pdf as an attachment. I've gotten as far as finding this.Maildoc and getting it to import the email addresses - but I can only seem to get it to pull values from ALL of the dropdowns rather than just the selected option in the current (shown) dropdown.
A programmer friend tried to help me (a bit blindly because I'm working in DC and he can't access the file) and wrote the following but it's showing an error in oForm not being defined properly so it wont submit the form.
var selected_index = oForm.elements["Level1", "Level2", "Level3", "Level4", "Level5"].selectedIndex;
if(selected_index > 0)
{
var selected_option_value = oForm.elements["Level1", "Level2", "Level3", "Level4", "Level5"].options[selected_index].value;
}else{
alert('Please select a Name from the drop down list');
}
this.mailDoc({
bUI: false,
cTo: "selected_option_value"
});
I've been looking at getElementById as another option but I really really have no idea what i'm doing - I know the most basic html and css, javascript is way over my head.
Any help would be greatly appreciated!
