-
1
- #1
dreamclutch
Programmer
Trying to parse out a date, and then compare it with two integer values from an options menu to see whether or not those two days(integers) are valid (if they are it runs the rest of the html, if not user is alerted with two days that they are allowed to use form). I think the problem area may be with my compare statement (if((holder) == dayOne || dayTwo) but not sure.
var holder
var theMonth
orderDate = new Date(document.form1.year.value, document.form1.month.value, document.form1.day.value)
holder = orderDate.getDay()
holder = parseInt(holder)
//this is to put the date in ##/##/#### format
theMonth = document.form1.month.value
theMonth = parseInt(theMonth)
theMonth = theMonth + 1
buildDate = theMonth + "/" + document.form1.day.value + "/" + document.form1.year.value
document.form1.theShipDate.value = buildDate
//is the selected date == to the day the shipment can be made
//alert(form1.Branch.options[form1.Branch.selectedIndex].value)
//splice form options data into comma delimited line with two intergers
var dayMush = form1.Branch.options[form1.Branch.selectedIndex].value.split(",");
var dayOne = parseInt( dayMush[0] );
var dayTwo = parseInt( dayMush[1] );
//if holder is equal to dayOne Integer or day two integer continue with page
if((holder) == dayOne || dayTwo){
}
//if not, alert user with only 2 days allowed
else{
if (form1.Branch.options[form1.Branch.selectedIndex].value == "SelectOne") {
alert("Please select a branch.")
return false
}
//get day of the week for alert
switch (dayOne) {
/code
}
switch (dayTwo) {
//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>
//date option menu, etc.
var holder
var theMonth
orderDate = new Date(document.form1.year.value, document.form1.month.value, document.form1.day.value)
holder = orderDate.getDay()
holder = parseInt(holder)
//this is to put the date in ##/##/#### format
theMonth = document.form1.month.value
theMonth = parseInt(theMonth)
theMonth = theMonth + 1
buildDate = theMonth + "/" + document.form1.day.value + "/" + document.form1.year.value
document.form1.theShipDate.value = buildDate
//is the selected date == to the day the shipment can be made
//alert(form1.Branch.options[form1.Branch.selectedIndex].value)
//splice form options data into comma delimited line with two intergers
var dayMush = form1.Branch.options[form1.Branch.selectedIndex].value.split(",");
var dayOne = parseInt( dayMush[0] );
var dayTwo = parseInt( dayMush[1] );
//if holder is equal to dayOne Integer or day two integer continue with page
if((holder) == dayOne || dayTwo){
}
//if not, alert user with only 2 days allowed
else{
if (form1.Branch.options[form1.Branch.selectedIndex].value == "SelectOne") {
alert("Please select a branch.")
return false
}
//get day of the week for alert
switch (dayOne) {
/code
}
switch (dayTwo) {
//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>
//date option menu, etc.