Hello,
I can't find how I can set $_GET variables to set manually the date in the date picker. http://jqueryui.com/demos/datepicker/
( example : http://www.something.com/?day=21&month=2&year=2010 )
Is that possible ?
Thanks
Hello,
I can't find how I can set $_GET variables to set manually the date in the date picker. http://jqueryui.com/demos/datepicker/
( example : http://www.something.com/?day=21&month=2&year=2010 )
Is that possible ?
Thanks
Use the gup function in this link to read the get parameters. Then call the setDate method (error handling omitted):
$(function() {
$("#Datepicker").datepicker();
var year = gup("year");
var day = gup("day");
var month = gup("month");
$("#Datepicker").datepicker("setDate", month + "/" + day + "/" + year);
});
$day = $_GET['day']; $month = $_GET['month']; $year = $_GET['year'];
$date = "'".$day."/".$month."/".$year."'";
<\script>
$.datePicker("setDate",$date);
<\script>
Simple :)
set minimum date if you want for datepicker:
<?php
$today = mktime(0,0,0,$_GET['month'],$_GET['day'],$_GET['year']);
?>
<script type="text/javascript">
var thisday = new Date('<?=(date('Y/m/d', $today);?>');
$("#YOUR_INPUT").datepicker({minDate: thisday, dateFormat: 'dd/mm/yy'});
</script>
or set automatically from GET variables:
<input type="text" name="YOUR_INPUT" id="YOUR_INPUT" value="<?=$_GET['day'];?>/<?=$_GET['month'];?>/<?=$_GET['year'];?>">
I think this should solve your problem.