datetime search problems
Archived from the Xataface Users forum.
astefl — 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:
- 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(); }
shannah — Tue Feb 09, 2010 6:59 pm
Let the browser do the encoding. If you encode, then it gets encoded twice. E.g. I saw that you have explicitly placed %20 in your fields. Just put a space - not %20.
Xataface works properly with URL encoding - but if you encode and then the browser encodes when submitting the form, then it’s double encoded.
astefl — Thu Feb 11, 2010 10:28 am
That fixed it. Thanks.
astefl — Mon Mar 01, 2010 6:19 pm
Okay I lied, it’s only halfway working. The start date is working, but the end date is not. I got rid of the encoding. It is still encoding in the url when I hit the search, but the end date is not working. I have also tried removing the Time from the datetime stamp and that isn’t working either. I put an Alert on the javascript to show the datefield and it showed:
=2010-02-25 00:00:00+AND+<=2010-02-27 23:59:59
I also tried:
=2010-02-25+AND+<=2010-02-27
The >= and <= were serialized when it was submitted, but changing them back in the URL doesn’t seem to help.
shannah — Mon Mar 01, 2010 6:42 pm
To do range searches use .. . E.g.
- Code: Select all
2010-02-25..2010-02-27
or
- Code: Select all
2010-02-25 00:00:00..2010-02-27 23:59:59
kevinwen — Wed Mar 03, 2010 5:55 pm
I have the problem uploading large size of file. I figured out that MAX_FILE_SIZE is defined as same as upload_max_filesize in php.ini. What if i want to set the MAX_FILE_SIZE to a number less than upload_max_filesize? where in my application could I define this? Thanks.
astefl — Thu Mar 04, 2010 5:24 pm
shannah wrote:To do range searches use .. . E.g.
- Code: Select all
2010-02-25..2010-02-27or
- Code: Select all
2010-02-25 00:00:00..2010-02-27 23:59:59
It looks like that works if I type it into the URL I will try adding it through code.