public function render($dateFormat = 'Y-m-d', $enableDatePicker = true)
    {
        $name = $this->getName();
        $this->registerFieldNameForFormTokenGeneration($name);

        $this->tag->addAttribute('type', 'date');
        $this->tag->addAttribute('name', $name . '[date]');
        if ($enableDatePicker) {
            $this->tag->addAttribute('readonly', true);
        }
        $date = $this->getSelectedDate();
        if ($date !== null) {
            $this->tag->addAttribute('value', $date->format($dateFormat));
        }

        if ($this->hasArgument('id')) {
            $id = $this->arguments['id'];
        } else {
            $id = 'field' . md5(Algorithms::generateRandomString(13));
            $this->tag->addAttribute('id', $id);
        }
        $this->setErrorClassAttribute();
        $content = '';
        $content .= $this->tag->render();
        $content .= '<input type="hidden" name="' . $name . '[dateFormat]" value="' . htmlspecialchars($dateFormat) . '" />';

        if ($enableDatePicker) {
            $datePickerDateFormat = $this->convertDateFormatToDatePickerFormat($dateFormat);
            $content .= '<script type="text/javascript">//<![CDATA[
				$(function() {
					$("#' . $id . '").datepicker({
						dateFormat: "' . $datePickerDateFormat . '"
					}).keydown(function(e) {
							// By using "backspace" or "delete", you can clear the datepicker again.
						if(e.keyCode == 8 || e.keyCode == 46) {
							e.preventDefault();
							$.datepicker._clearDate(this);
						}
					});
				});
				//]]></script>';
        }
        return $content;
    }
public function render($dateFormat = 'Y-m-d', $enableDatePicker = true)
    {
        $name = $this->getName();
        $this->registerFieldNameForFormTokenGeneration($name);

        $this->tag->addAttribute('type', 'date');
        $this->tag->addAttribute('name', $name . '[date]');
        if ($enableDatePicker) {
            $this->tag->addAttribute('readonly', true);
        }
        $date = $this->getSelectedDate();
        if ($date !== null) {
            $this->tag->addAttribute('value', $date->format($dateFormat));
        }

        if ($this->hasArgument('id')) {
            $id = $this->arguments['id'];
        } else {
            $id = 'field' . md5(Algorithms::generateRandomString(13));
            $this->tag->addAttribute('id', $id);
        }
        $this->setErrorClassAttribute();
        $content = '';
        $content .= $this->tag->render();
        $content .= '<input type="hidden" name="' . $name . '[dateFormat]" value="' . htmlspecialchars($dateFormat) . '" />';

        if ($enableDatePicker) {
            $datePickerDateFormat = $this->convertDateFormatToDatePickerFormat($dateFormat);
            $content .= '<script type="text/javascript">//<![CDATA[
				$(function() {
					$("#' . $id . '").datepicker({
						dateFormat: "' . $datePickerDateFormat . '"
					}).keydown(function(e) {
							// By using "backspace" or "delete", you can clear the datepicker again.
						if(e.keyCode == 8 || e.keyCode == 46) {
							e.preventDefault();
							$.datepicker._clearDate(this);
						}
					});
				});
				//]]></script>';
        }
        return $content;
    }
public function render ( $ dateFormat = 'Y-m-d' , $ enableDatePicker = true ) { $ name = $ this -> getName ( ) ; $ this -> registerFieldNameForFormTokenGeneration ( $ name ) ; $ this -> tag -> addAttribute ( 'type' , 'date' ) ; $ this -> tag -> addAttribute ( 'name' , $ name . '[date]' ) ; if ( $ enableDatePicker ) { $ this -> tag -> addAttribute ( 'readonly' , true ) ; } $ date = $ this -> getSelectedDate ( ) ; if ( $ date !== null ) { $ this -> tag -> addAttribute ( 'value' , $ date -> format ( $ dateFormat ) ) ; } if ( $ this -> hasArgument ( 'id' ) ) { $ id = $ this -> arguments [ 'id' ] ; } else { $ id = 'field' . md5 ( Algorithms :: generateRandomString ( 13 ) ) ; $ this -> tag -> addAttribute ( 'id' , $ id ) ; } $ this -> setErrorClassAttribute ( ) ; $ content = '' ; $ content .= $ this -> tag -> render ( ) ; $ content .= '<input type="hidden" name="' . $ name . '[dateFormat]" value="' . htmlspecialchars ( $ dateFormat ) . '" />' ; if ( $ enableDatePicker ) { $ datePickerDateFormat = $ this -> convertDateFormatToDatePickerFormat ( $ dateFormat ) ; $ content .= '<script type="text/javascript">//<![CDATA[
				$(function() {
					$("#' . $ id . '").datepicker({
						dateFormat: "' . $ datePickerDateFormat . '"
					}).keydown(function(e) {
							// By using "backspace" or "delete", you can clear the datepicker again.
						if(e.keyCode == 8 || e.keyCode == 46) {
							e.preventDefault();
							$.datepicker._clearDate(this);
						}
					});
				});
				//]]></script>' ; } return $ content ; }
Renders the text field, hidden field and required javascript

@param string $dateFormat
@param boolean $enableDatePicker
@return string
Renders the text field hidden field and required javascript