4 Replies - 2092 Views - Last Post: 07 October 2013 - 02:29 AM

#1 rodneyqc  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 134
  • Joined: 02-August 13

Datepicker value help

Posted 05 October 2013 - 04:21 AM

Hello im rodney, i would like to ask if how can i pass the value from my selected jquery datepicker in a variable.
because i plan to retrieve records depend on the date that i chose in the datepicker which needs to be compare in database. But i dont know how to retrieve the selected date and pass it in a php variable.

<!DOCTYPE HTML>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Datepicker - Display inline</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(document).ready(function() {
  $('#datepicker').datepicker( {
    onselect: function(date) {
        alert(date);	
    },
  });
});
  </script>
</head>
<body>
Date: <div id="datepicker"></div>
</body>
</html>



sorry for my grammar, thank you

Sorry for my multiple posts of the same topic. my fault.

This post has been edited by Dormilich: 06 October 2013 - 12:05 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Datepicker value help

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,251
  • Joined: 08-June 10

Re: Datepicker value help

Posted 06 October 2013 - 12:12 AM

first and foremost, a datepicker is applied to an input field, not a div.

once you have the date in the input field, you can send it over to PHP by a form submit or by AJAX.
Was This Post Helpful? 0
  • +
  • -

#3 rodneyqc  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 134
  • Joined: 02-August 13

Re: Datepicker value help

Posted 06 October 2013 - 12:51 AM

Hello, what i mean is i want it to trigger right away, when i click/choose a date, the date value would be transfer to a php file right away. I want to have a datepicker that when i choose a date it will output the records which has the date that you choose in the datepicker. sorry for my grammar, thanks
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,251
  • Joined: 08-June 10

Re: Datepicker value help

Posted 06 October 2013 - 12:55 AM

you could use the callback when a date is picked (cf. dialog())
Was This Post Helpful? 0
  • +
  • -

#5 rodneyqc  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 134
  • Joined: 02-August 13

Re: Datepicker value help

Posted 07 October 2013 - 02:29 AM

hello i was able to make my datepicker to show the records in a certain date which i clicked in the calendar.
but im using 2 page. which is my datepicker2 and datestore2 -> which will retrieve all the records in database which has that date.

heres my code..

$(function() {
			$("#datepicker").datepicker({
				dateFormat: "dd-mm-yy",
				onselect: function(dateText, inst) {
					var date = $.datepicker.parseDate(inst.settings.dateFormat || $.datepicker._defaults.dateFormat, dateText, inst.settings);
					var dateText1 = $.datepicker.formatDate("M d yy", date, inst.settings);
					
					var test = dateText1;
			
					location.href="datestore2.php?Result=" + dateText1;	
				}
			});
		});

and the datestore2 page will _GET the Result value using location.href



i want to make a 2 div left: datepicker right: datestore -> which where my records will appear when i clicked a date.

i was about to this
$('ul#nav li a').click(function(){
		var page = $(this).attr('href');
		$('#content').load('content/' + page + '.php');
		return false;
	});
but cant find an idea what to replace with .click function (ul#nav li a) thing.. sorry for my grammar. thanks

This post has been edited by rodneyqc: 07 October 2013 - 02:30 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1