Text box value doesn't get post after selecting a date from Jquery datepicker

1.4k Views Asked by At

I create a textbox and add a Jquery UI datepicker.But when I select and click the button.the textbox doesnt get post and show an error message like(Notice: Undefined index: date_text in C:....................\file.php on line 57 ).But when I enter a date using keyboard without having a datepicker it will submit well.Please help me.How can I do this having datepicker

this is my jquery code

<script>
    $(function() {
        $( "#datepicker" ).datepicker();

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

    });
    </script>

this is my textfield

<div id="datetobe">Date to be dispose
               <label for="date_to_dispose"> <input name="datepicker" type="text" id="datepicker"   class="textfield" /></label>
              </div>  
1

There are 1 best solutions below

9
Matt On BEST ANSWER

You have to set the callback function for the datepicker.

http://jqueryui.com/demos/datepicker/

Events tab, onSelect event. RTM.

$('#datepicker').datepicker({
    format: 'whatever',
    onSelect: function(dateText, inst) { ... }
});