Abu Hanif
Abu Hanif

Reputation: 21

Datepicker not showing current value when edit cakephp form

I am using jquery date picker with cakephp 2.3. Datepicker popup is OK.

When I want to edit a any record, it does not display date field value in form. I checked many ways and I am sure that it is date picker issue.

Populated source code of date field

<input id="CallDateTo" class="hasDatepicker" type="text" value="2013-04-15" name="data[Call][date_to]">

Here we see that value exist in HTML but it does not display in form.

Any one can help me?

Upvotes: 0

Views: 2274

Answers (2)

Abu Hanif
Abu Hanif

Reputation: 21

Yes, I found the solution. I have to write as bellow

$( "#CallDateFrom, #CallDateTo" ).datepicker({ dateFormat: "yy-mm-dd"});

Before that I wrote as bellow and caused the problems.

$( "#CallDateFrom, #CallDateTo" ).datepicker({ changeMonth: true, changeYear: true}); $( "#CallDateFrom, #CallDateTo" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );

Upvotes: 2

Arun P Johny
Arun P Johny

Reputation: 388436

Set the date using correct format

  $('#CallDateTo').datepicker({
    dateFormat: "yy-mm-dd"
  });

Demo: Plunker

Upvotes: 0

Related Questions