views:

82

answers:

1
$(document).ready(function(){
 $('#data_nasterii').datepicker($.datepicker.regional['ro']); // romanian language
 $('#data_nasterii').datepicker('option', 'changeMonth', true); // dropdown with month
 $('#data_nasterii').datepicker('option', 'changeYear', true); // dropdown with year
 $('#data_nasterii').datepicker('option', 'yearRange', '1900:2020'); // selectable years
 $('#data_nasterii').datepicker('option', 'dateFormat', 'yy-mm-dd'); // date format(ex: 1981-07-25)

});

...
// creating date field with php

echo "<td><div align=\"left\"><input name=\"data_nasterii\" type=\"text\" id=\"data_nasterii\" value=\"".$row['data_nasterii']."\" size=\"10\" maxlength=\"10\" /></div></td></tr>";

if i hit "Clear form" field gets the right value

Thank you in advance!

A: 

The right way of setting options is not repeating them again and again as you are doing.

$(this).datepicker({
        showButtonPanel: true,
        closeText: 'X',
        dateFormat: 'mm/dd/yy',
        buttonText: 'Select Date',
        showOn: 'button',
        duration: 'fast'
    });

Try doing in this format and see. Also try not setting the value in the date object and try to set after the page load using java script.

Teja Kantamneni