0

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?

thaJeztah
  • 27,738
  • 9
  • 73
  • 92
Abu Hanif
  • 21
  • 2
  • Could you put the code of your view and action of the form in your question please? And also in what format are you storing the date in the db and what's the format you want to display in the form – Nunser Apr 19 '13 at 18:28
  • what is the date format used in the datepicker – Arun P Johny Apr 20 '13 at 08:35

2 Answers2

2

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' );

Abu Hanif
  • 21
  • 2
0

Set the date using correct format

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

Demo: Plunker

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
  • 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' ); – Abu Hanif Apr 20 '13 at 16:43
  • @AbuHanif To solve the actual problem mentioned by you, my answer is enough – Arun P Johny Apr 20 '13 at 16:45