Click to See Complete Forum and Search --> : help with switch


georgeb
12-07-2003, 12:13 PM
I have a form select with three values
arriving
departing
roundtrip

on submit I run a jscript (VC)
at the top of the vc function is
function vc(obj) {
var oneround =obj.OneWay_RoundTrip.selected; //should this be selected or value? i've tried both...
switch ( oneround )
{
case "Arrving":
var reqFields = new parseArray("FirstName", "LastName");
var reqFieldsDesc = new parseArray("First Name", "Last Name");
case "Departing":
var reqFields = new parseArray("name", "email");
var reqFieldsDesc = new parseArray("Name", "Email Address");
case "RoundTrip":
var reqFields = new parseArray("name", "email");
var reqFieldsDesc = new parseArray("Name", "Email Address");

}

the vars are not gettin populated....I don't have my JS book and am not sure how this switch should work...
TIA

ray326
12-07-2003, 07:10 PM
No manual? How about Google with javascript switch statement?

switch (variable) {
case "0":
alert('this is 0')
break;
case "1":
alert('this is 1')
break;
case "2":
alert('this is 2')
break;
case "3":
alert('this is 3')
break;
case "4":
alert('this is 4')
break;
}