9

Can someone explain how to capture the selected date from the inline/embedded version of Eternicode's extended Bootstrape Datepicker - http://eternicode.github.io/bootstrap-datepicker/

<form class="form-date" role="form" action="/'.$ref.'/edit" method="get">
    <div class="form-group" id="datepickid">
        <div></div>
        <input type="hidden" name="dt_due" id="dt_due">
    </div>
    <button type="submit" class="btn btn-default">Submit</button>
</form>

...

$('#datepickid div').datepicker({
    startDate: "+1d",
    todayHighlight: true
});

As I'm sure is clear, I want it to write to the hidden input when the date selected changes.

I'm sure i'm missing something obvious, but the other examples write to the input it is linked too, but there seems to be no obvious way the data is output from the inline version.

All help appreciated.

4

4 に答える 4

19

気にしないでください、答えはGoogleグループを介して与えられました.

.on(ChangeDate) を追加する必要がありました...

$('#datepickid div').datepicker({
    startDate: "+1d",
    todayHighlight: true
    }).on('changeDate', function(e){
      $('#dt_due').val(e.format('dd/mm/yyyy'))
    });
于 2013-10-01T13:48:28.883 に答える