HELP - email address problem - need to reset a variable

I created a form that will be submitted to certain different email addresses based on an option selected from a drop-down list (named Customer).
I tried another script posted here, but that was based on the assumption that there was only one choice per email address in the list.
I wrote this on the change event of my list. I want the variable "emailAddress" to adopt the correct email address, based on the value of the option selected from the list:
var emailAddress = "[email protected]";
if (Customer.rawValue = "3"|"4"|"7") {
emailAddress = "[email protected]";
else if (Customer.rawValue = "5"|"8"|"15"|"20"|"21"|"26") {
emailAddress = "[email protected]";
else if (Customer.rawValue = "9"|"10"|"13") {
emailAddress = "[email protected]";
else {
emailAddress = "[email protected]";
Then I copied this (from the other topic), on the click event of a regular button ,which calls for a second, hidden button:
EmailSubmitButton1.resolveNode("#event").submit.target = "mailto:"+ emailAddress;
EmailSubmitButton1.execEvent("click");
The form worked fine the first time, but after that, all submissions are going to [email protected] I'm thinkking that the variable emailAddress has now a fixed value, and does not change.
I am new to Javascript, so I might have not written the code properly, any help will be greatyl appreciated!
Thank you.

Daeveed:
I think your javascript syntax is problematic. Instead of the syntax
if (Customer.rawValue = "3"|"4"|"7")
try
if (Customer.rawValue == "3"|"4"|"7")
Note the double equals sign. That's the equality comparison operator in javascript. The single equals is assignment.
if that still doesn't work, try
if ((Customer.rawValue == "3") || (Customer.rawValue == "4") || (Customer.rawValue == "7"))
Hope this helps.

Similar Messages

Maybe you are looking for