I am trying to get the jQuery UI datepicker to submit a form when I
click on one of the days in the datepicker.
I can get the datepicker to appear as expected and, if I click on the
explicit submit button I have added the post method gets called.
However I can't get onSelect to submit the form. I seem to be doing
what is described in examples I can find on Google.
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()");},
dateFormat: "dd/mm/yy"});
});
... and the HTML form is:-
<FORM METHOD=post ACTION="form.php" ID="xyzform" accept-charset="utf-8" enctype="multipart/form-data" >
<p>Date: <input type="text" name="xvdate" id="xvpicker"><input type="submit" name="xvsubm"></p>
</FORM>
Oh, and the alert message *does* pop up when I click on a day in the
date picker. So the onSelect: code is executing, it's just that the
submit() call doesn't seem to be submitting the form. I have tried
using the form ID instead, i.e. jQuery('#xyzform').submit() but this
doesn't work either.
--
Chris Green