Skip to content

Commit

Permalink
Merge pull request #10 from daniellienert/task/change-field-type-to-date
Browse files Browse the repository at this point in the history
TASK: Change field type to date to enable HTML5 date selector

Currently the date selector uses jQuery UI for the date selector.
This PR changes the field type for the date selector to "date"
to enable the HTML5 date selector as soon you disable the
jQuery script.
  • Loading branch information
kdambekalns committed May 13, 2016
2 parents b6ef303 + b547ae3 commit aef5098
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Classes/TYPO3/Form/ViewHelpers/Form/DatePickerViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
* */

use TYPO3\Flow\Annotations as Flow;
use TYPO3\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper;

/**
* Display a jQuery date picker.
*
* Note: Requires jQuery UI to be included on the page.
*/
class DatePickerViewHelper extends \TYPO3\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper
class DatePickerViewHelper extends AbstractFormFieldViewHelper
{
/**
* @var string
*/
protected $tagName = 'input';

/**
* @var TYPO3\Flow\Property\PropertyMapper
* @var \TYPO3\Flow\Property\PropertyMapper
* @Flow\Inject
*/
protected $propertyMapper;
Expand Down Expand Up @@ -60,7 +61,7 @@ public function render($dateFormat = 'Y-m-d', $enableDatePicker = true)
$name = $this->getName();
$this->registerFieldNameForFormTokenGeneration($name);

$this->tag->addAttribute('type', 'text');
$this->tag->addAttribute('type', 'date');
$this->tag->addAttribute('name', $name . '[date]');
if ($enableDatePicker) {
$this->tag->addAttribute('readonly', true);
Expand Down

0 comments on commit aef5098

Please sign in to comment.