views:

120

answers:

3

I have a form with an date field with a jquery datepicker attached to it.

When I select the date field the datepicker pops up but then the iPad keyboard slides into view and obscures the datepicker.

How do I prevent the keyboard from popping up in this situation?

A: 

Didn't discover a way to do this but I ended up using an acceptable work around of using the buttonImage feature with buttonImageOnly and then disabling the date field.

$("#id_date").datepicker({
        dateFormat: 'yy/mm/dd',
        showOn:"button",
        buttonImage: "/icons/calendar.gif",
        buttonImageOnly: true });
$('#id_date').attr("disabled", true);

If you are doing this on a form, make sure you re-enable the field before submitting or serializing the form or the value won't be sent (on iPad at least). I do the following in my submit function:

$('#id_date').attr("disabled", false);
var dataString = $('#the_form').serialize();
$.ajax({
     type: "POST",
     url: 'myurl',
     data: dataString,
     ...
Rob Osborne