datetime search problems
Posted: Tue Feb 09, 2010 6:30 pm
I have some javascript that validates my search criteria then sends the startdate, and enddate to a hidden date field. the problem I'm having is that when I submit my datetime the data is URL encoded and xataface will not perform a proper search. If I type the URL in manually, the search works fine. I am using Xataface v1.2.2, the field is a datetime field. Any Ideas would be appreciated.
Here is my javscript:
Here is my javscript:
- Code: Select all
function submit_advSearch(){
debugger;
var startDate = advSearch.startdate.value;
var endDate = advSearch.enddate.value;
var call_datetime = '';
var sdate;
var edate;
//validate startdate < enddate
if(startDate != ''){
sdate = new Date(startDate.replace("-","/"));
}
if(endDate !=''){
edate = new Date(endDate.replace("-","/"));
}
if (startDate !='' && endDate != '' && sdate > edate){
alert('Start Date must be earlier than End Date');
return false;
}
//END: validate startdate < enddate
//Build call_datetime
if (startDate != ''){
call_datetime = '>=' + startDate + '%2000:00:00';
}
if (startDate != '' && endDate != ''){
call_datetime += '+AND+<=' + endDate + '%2023:59:59';
}else if(startDate != '' && endDate == ''){
call_datetime = '>=' + startDate;
}else if(startDate == '' && endDate != ''){
call_datetime = '<=' + endDate + '%2023:59:59';
}
document.advSearch.call_datetime.value = call_datetime;
document.advSearch.submit();
}