Hi,
I have a php page which is calling a javascript function that checks a hotel reservation database to see if the property is available. The reserved dates are provided as a string (php array imploded with a space between values) to the js function, and the js function create an array out of this string and then checks to see if the submitted timeperiod contiains each date stamp.
I keep getting "error object expected." At first I thought the string might be too long, but I don't think that is the case.
then I have a javascript function:
Any help you can provide will be much appreciated!
Thank you.
I have a php page which is calling a javascript function that checks a hotel reservation database to see if the property is available. The reserved dates are provided as a string (php array imploded with a space between values) to the js function, and the js function create an array out of this string and then checks to see if the submitted timeperiod contiains each date stamp.
I keep getting "error object expected." At first I thought the string might be too long, but I don't think that is the case.
Code:
<from action="form.php" method="post" enctype="application/x-[URL unfurl="true"]www-form-urlencoded"[/URL] name="CheckAvailability21" id="frmCheckAvailability21" onsubmit="return checkform(this, '1188619200 1188705600 1188792000 1188878400 1188964800 1189051200 1189137600 1189224000 1189310400 1189396800 1189483200 1189569600 1189656000 1189742400 1189828800 1189915200 1190001600 1190088000 1190174400 1190260800 1190347200 1190433600 1190520000 1190606400 1190692800 1190779200 1190865600 1190952000 1191038400 1191124800')">
then I have a javascript function:
Code:
function checkform ( form, temp )
{
var start_date = new Date(form.start_year.value,form.start_month.value-1,form.start_day.value);
var end_date = new Date(form.end_year.value,form.end_month.value-1,form.end_day.value);
if(temp != ''){
var a = new Array();
a = temp.split(' ');
for(p=0;p<a.length;p++){
//alert(a[p]);
res_date = new Date();
res_date.setTime(1000*(a[p])-75600000);
alert( start_date+"<="+res_date+"<"+end_date );
if ((res_date>=start_date)&&(res_date<end_date)) {
alert( "This property is already reserved during this time period." );
form.start_month.focus();
return false;
}
}
}
}
Any help you can provide will be much appreciated!
Thank you.