Forum Moderators: open
<script language="javascript">
var d = new Date()
tempFilMonth = d.getMonth() + 1;
tempFilYear = d.getFullYear();
tempFilDay = d.getDate();function FilterLogDate()
{
FilterDateNow = tempFilYear +"-"+ tempFilMonth +"-"+ tempFilDay;
FilterTempLogDate = document.ViewForm.FilterYear.value +"-"+ document.ViewForm.FilterMonth.value +"-"+ document.ViewForm.DayChoice.value;if (FilterTempLogDate > FilterDateNow)
{
("Filtering in advance is not allowed")
}
}
</script>
<form>
<select class=select id="FilterMonth" name="FilterMonth" style="width:12%;" onchange="FilterLogDate()">
<option value="1">January</option>
...
<option value="11">November</option>
<option value="12">December</option>
</select><select class=select name="FilterYear" style="width:8%;">
<? for ($iYear=strftime("%Y",(time()))-1; $iYear<=strftime("%Y",(time())); $iYear=$iYear+1)
{
?>
<option value="<? echo $iYear;?>"><? echo $iYear;?></option>
<? }?>
</select>
</form>
thanks
I would try this:
<script language="javascript">
var d = new Date()
tempFilMonth = d.getMonth() + 1;
tempFilYear = d.getFullYear();
tempFilDay = d.getDate();
function FilterLogDate()
{
FilterDateNow = tempFilYear +"-"+ tempFilMonth +"-"+ tempFilDay;
FilterTempLogDate = document.ViewForm.FilterYear.value +"-"+ document.ViewForm.FilterMonth.value +"-"+ document.ViewForm.DayChoice.value;
splita=FilterTempLogDate.split("-");
splitb=FilterDateNow.split("-");
if (splita[0] > splitb[0] ¦¦ splita[1] > splitb[1])
{
alert("Filtering in advance is not allowed")
}
else if (splita[0] > splitb[0])
{
if(splita[1] > splitb[1] ¦¦ splita[2] > splitb[2])
{
alert("Filtering in advance is not allowed")
}
}
}
</script>
<form>
<select class=select id="FilterMonth" name="FilterMonth" style="width:12%;" onchange="FilterLogDate()">
<option value="1">January</option>
...
<option value="11">November</option>
<option value="12">December</option>
</select>
<select class=select name="FilterYear" style="width:8%;">
<? for ($iYear=strftime("%Y",(time()))-1; $iYear<=strftime("%Y",(time())); $iYear=$iYear+1)
{
?>
<option value="<? echo $iYear;?>"><? echo $iYear;?></option>
<? }?>
</select>
</form>