Hello All,
I am trying get the advanced search page to search between two dates using the "between" option. I have a sql datetime field called "red_TimeStamp" and would like it when someone goes to the advanced search page for this field to automatically have selected "between" and the two search fields to be popuplated; the first one with a date 2 weeks prior to todays date and the second one to have todays date in it. I have followed a previous post, http://www.asprunner.com/forums/topic/12907-default-date-range-advanced-search/ with no luck. I have PHP Runner 5.3 and am using Microsoft SQL as my database. Here is the code I have based off of that post:
global
$red_TimeStamp_editcontrol,$red_TimeStamp_editcontrol1;
$red_TimeStamp_editcontrol["params"]["value"] = date("Y-m-d",strtotime("-2 week"));
$red_TimeStamp_editcontrol1["params"]["value"] = date("Y-m-d");
// write search options
$opt = "Between";
$options="";
$options.="<OPTION VALUE=\"Equals\" ".(($opt=="Equals")?"selected":"").">Equals</option>";
$options.="<OPTION VALUE=\"More than\" ".(($opt=="More than")?"selected":"").">More than</option>";
$options.="<OPTION VALUE=\"Less than\" ".(($opt=="Less than")?"selected":"").">Less than</option>";
$options.="<OPTION VALUE=\"Between\" ".(($opt=="Between")?"selected":"").">Between</option>";
$options.="<OPTION VALUE=\"Empty\" ".(($opt=="Empty")?"selected":"").">Empty</option>";
$searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_red_TimeStamp\" SIZE=1 onchange=\"return ShowHideControls();\">";
$searchtype .= $options;
$searchtype .= "</SELECT>";
$searchtype;
$xt->assign("searchtype_red_TimeStamp",$searchtype);
I am getting an error " 'get(...)'is null or not an object" from IE.
If it matters, the "View As" setting is datetime.
Thanks for any help.