What is wrong with my JQuery UI datepicker option code? I have an AJAX view using Views 3 and Better Exposed Filters (and therefore jQuery UI datepicker).  One of the exposed filters is dates between [post-date] (core).

The form works fine, but when dates are entered and submitted (via AJAX) the visible entries in the input fields disappear.

Before:



After:



It doesn't happen to other text fields, only date fields, and it stops happening when I change the Exposed Form type to 'Basic'.  I'm sure it's BEF causing the issue but what's really puzzling is that the input values are there in the HTML after submit:

&lt;input ... value="2015-05-01" ...&gt;


Why isn't it showing in the input field?

[edit:] I tried to reproduce this on a blank site and couldn't.  No longer certain the root cause is in BEF.



Additional information:

I've tracked the problem down to some custom JQuery code to add options to the datepicker post-render.  The options are added no worries, I just can't figure out why it breaks the inputs.

(function ($) {
Drupal.behaviors.myPageFilters = {
  attach: function (context, settings) {

    $("label[for='edit-post-date-max']", context).once('changeBetweenText', function(){
        $(this).text("to");
    });


    // This is the culprit, commenting out this block stops the weird behaviour
    $(".bef-datepicker", context).once('changeDatePickerFormat', function(){
        $(this).datepicker("option", "changeYear", true).datepicker("option", "changeMonth", true);
        $(this).datepicker("option", "dateFormat", "yy-mm-dd").datepicker("option", "showButtonPanel", true);
        $(this).datepicker("option", "buttonImage", "/sites/all/themes/mytheme/images/exposed-filter-calendar.png").datepicker("option", "showOn", "both");
    });



    $(".bef-secondary-options", context).once('createSecondarySubmit', function(){
        $(this).append('&lt;input type="submit" id="bef-secondary-submit" value="Apply" class="form-submit"&gt;');
    });

  }
};   
}(jQuery));




It's this:

$(this).datepicker("option", "dateFormat", "yy-mm-dd");


I placed it there to change the date format away from the US format provided in BEF code (AUS site).

I just discovered the jQuery UI Datepicker option field in BEF. /facepalm

I'll leave this question here in case anyone ends up with the same issue.
Put your datepicker options in via the Views UI rather than custom jQuery.