dreamclutch
Programmer
Trying to grab an options value from a form option usnig javsascript, and then sorta out the values into two integers for a case method. If I manually enter integers in the case method it works. The issue seems to lie with either the options value syntax or substr? Thanks
//Javascript Code
//convert form options data from comma delimited line (x,x) to 2 intergers
var day1 = form1.Branch.options[form1.Branch.selectedIndex].value
var day2 = form1.Branch.options[form1.Branch.selectedIndex].value
day1.substr(0,1) //returns first interger day
day2.substr(2,3) //returns second interger day
//get day of the week for alert
//two case methods grabbing two numbers
//switch (first integer) {
//code }
//switch (second interger) {
//code }
<form name="form1" method="post" action="shipUpdate.asp" onSubmit="return check_date()">
//some other form code
//option values below (4 and 5) are parsed from a two db fields
<select name="Branch">
<option value="SelectOne" selected>Select One</option>
<option value="4,5" label="101-9th Avenue">101-9th Avenue</option>
</option>
//Javascript Code
//convert form options data from comma delimited line (x,x) to 2 intergers
var day1 = form1.Branch.options[form1.Branch.selectedIndex].value
var day2 = form1.Branch.options[form1.Branch.selectedIndex].value
day1.substr(0,1) //returns first interger day
day2.substr(2,3) //returns second interger day
//get day of the week for alert
//two case methods grabbing two numbers
//switch (first integer) {
//code }
//switch (second interger) {
//code }
<form name="form1" method="post" action="shipUpdate.asp" onSubmit="return check_date()">
//some other form code
//option values below (4 and 5) are parsed from a two db fields
<select name="Branch">
<option value="SelectOne" selected>Select One</option>
<option value="4,5" label="101-9th Avenue">101-9th Avenue</option>
</option>