CakePHP FormHelper and IE Problems with Date

294 views Asked by At

I'm building a calendar app using CakePHP and it's looking great in Chrome/Firefox etc however when I went to do some testing in IE I noticed that the Date picker isn't loading at all:

IE Date Picker

Chrome Date Picker

Any help would be appreciated.

Ross.

EDIT: PHP code and HTML Output

echo $this->Form->input('start_date', array(
    'type' => 'Date',
    'label' => array('text' => 'Start Date', 'class' => 'formField'),'dateFormat' => 'DMY','minYear' => date('Y') - 70, 'maxYear' => date('Y') - 18,));

echo $this->Form->input('end_date', array(
    'type' => 'Date',
    'label' => array('text' => 'End Date', 'class' => 'formField'),'dateFormat' => 'DMY','minYear' => date('Y') - 70,'maxYear' => date('Y') - 18,));

HTML:

<form action="/EbCal/admins/report" id="reportIndexForm" method="post" accept-charset="utf-8">
  <div style="display:none;">
    <input type="hidden" name="_method" value="POST"/>
  </div>
  <div class="input Date">
    <label for="reportStartDate" class="formField">Start Date</label>
    <input name="data[report][start_date]" dateFormat="DMY" minYear="1943" maxYear="1995" type="Date" id="reportStartDate"/>
  </div>
  <div class="input Date">
    <label for="reportEndDate" class="formField">End Date</label>
    <input name="data[report][end_date]" dateFormat="DMY" minYear="1943" maxYear="1995" type="Date" id="reportEndDate"/>
  </div>
  <BR>
  <div class="submit">
    <input  type="submit" value="Generate Report"/>
  </div>
</form>
1

There are 1 answers

1
hyarion On BEST ANSWER

Internet Explorer as well as Firefox do not support the input type of "date". (i.e. <input type="Date">)

CakePHP will usually generate a set of select dropdowns to choose the date if the browser is IE. I'm not sure why yours is not, but the select dropdowns seldom look very user friendly.

The best solution to support IE and other browsers is to implement a javascript solution for a datepicker.

There are many out there, the one I've found most user-friendly is this one: http://www.ama3.com/anytime/