3 forms to choose from based on value of variable - javascript

I will try to write out in layman's terms what i am looking for....  if variable = 1, i want to choose html form named "region_west" and send an email to a sales rep that is located in the west, if variable = 2, i want to choose html form named "region_central that will send email to central sales rep, if variable = 3, i want to choose html form named "region_east that will send email to east sales rep

i am defining the variable value correctly and have the forms developed, but need help with the if statement to select the correct form.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

nschaferConnect With a Mentor Commented:
I'm not 100% sure what you are trying to achive.  I understand what you have asked and I'll answer it first:

if (variable == 1) document.forms["region_west"].submit();
if (variable == 2) document.forms["region_central"].submit();
if (variable == 3) document.forms["region_east"].submit();

or you can use the switch statement:

switch(variable) {
  case 1:
  case 2:
  case 3:

But do you really have 3 forms? Do they gather the same information depending on what region the user is from?  What if the user fills out the wrong one?  Wouldn't it be better to have a single form collect the information and then just send the e-mail to the appropriate person based on the selected region?  
Perhaps I misunderstood.

cofcmgrAuthor Commented:
The actual input form is the same for each region.  The diffent form for each region consists of hidden objects.  The "hidden" form for one of the regions are .......

form action="/applications/formsprocessor/default.aspx" name="region_west" method="post">
 <input type="hidden" name="to_address"   value="sample@email.com">
 <input type="hidden" name="subject"   value="Subject Line">
 <input type="hidden" name="from_address" value="DoNotReply@mail.com">      
 <input type="hidden" name="redirect"   value="/acquisition/thankyou.html">
 <input type="hidden" name="mail_server"  value="mail.mail.com">
 <input type="hidden" name="body_format"  value="text">

thanks a million!
Glad I could help,
All Courses

From novice to tech pro — start learning today.