Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jQuery Ui datepicker postback onselect()

Posted on 2009-04-10
4
Medium Priority
?
3,566 Views
Last Modified: 2012-05-06
Hello,

Is it possible to make the datepicker post back to the same page when a date is
selected? If so please advise... Thank in advance for your help!!!


<script type="text/javascript">
                      $(function(){
 
                              // Datepicker
                              $('#datepicker').datepicker({
                                      inline: true,
                                      minDate: -0,
                                      maxDate: '1D +6M'
                              });
 
                      });
</script>
 
<!-- Datepicker -->
<h2 class="demoHeaders">Datepicker</h2>
<div id="datepicker"></div>

Open in new window

0
Comment
Question by:Bradino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 800 total points
ID: 24120200
The datepicker onSelect event will let you do whatever you want when a date is selected.  What are you looking to do with your post back?

<script type="text/javascript">
$(function(){
  // Datepicker
  $('#datepicker').datepicker({
    inline: true,
    minDate: -0,
    maxDate: '1D +6M',
    onSelect: function(dateText) {
      // do whatever here
    }
  });
});
</script>

Open in new window

0
 

Author Comment

by:Bradino
ID: 24120929
Thanks for your response Anoyes, it worked like a charm! Here is my update code, now my question is this the proper syntax?

<script type="text/javascript">
$(function(){
// Datepicker
   $('#datepicker').datepicker({
	inline: true,
	minDate: -0, 
	maxDate: '1D +6M',
	onSelect: function(dateText) {
      	// do whatever here    
	window.location = "selected.cfm?bookDate=" + dateText;
	}
});		
});				
</script>

Open in new window

0
 
LVL 16

Expert Comment

by:anoyes
ID: 24122189
Looks like the proper syntax to me.  Are you having trouble with it?
0
 

Author Comment

by:Bradino
ID: 24124606
No it works fine, I'm new to jQurey just wanted to make sure that best practice, thanks...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question