On 10 October 2012 23:53, Chris Green <cl@isbd.net> wrote:
I am trying to get the jQuery UI datepicker to submit a form when I click on one of the days in the datepicker. ... Can anyone here see the (probably obvious) error?
The javascript code in the headers is:-
jQuery(function() { jQuery( "#xvpicker" ).datepicker({ onSelect: function (dateText, inst) { jQuery(this).parent('form').submit(); alert("onSelect()");},
^^^ This line looks suspicious to me ^^^ It's not obvious to me what jQuery(this).parent('form') would return at this point - for that reason, I'd use simply the following ... jQuery(document).ready(function () { jQuery( "#xvpicker" ).datepicker({ onSelect: function (dateText, inst) { jQuery("#xyzform").submit(); }, dateFormat: "dd/mm/yy" }); }); which works fine for me. In which case, your problem may be that you're not wrapping the function in a .ready() function. HTH, Greg