diff --git a/code/model/formfields/EditableDateField.php b/code/model/formfields/EditableDateField.php index e9adaa0..f381392 100755 --- a/code/model/formfields/EditableDateField.php +++ b/code/model/formfields/EditableDateField.php @@ -38,22 +38,19 @@ class EditableDateField extends EditableFormField { */ public function getFormField() { $defaultValue = ($this->getSetting('DefaultToToday')) ? date('Y-m-d') : $this->Default; - $field = new DateField( $this->Name, $this->Title, $defaultValue); + $field = new EditableDateField_FormField( $this->Name, $this->Title, $defaultValue); $field->setConfig('showcalendar', true); + return $field; } - - /** - * Return the validation information related to this field. This is - * interrupted as a JSON object for validate plugin and used in the - * PHP. - * - * @see http://docs.jquery.com/Plugins/Validation/Methods - * @return Array - */ - public function getValidation() { - return array_merge(parent::getValidation(), array( - 'date' => true - )); - } } + +/** + * @package userforms + */ +class EditableDateField_FormField extends DateField { + + public function Type() { + return "date-alt text"; + } +} \ No newline at end of file diff --git a/templates/ValidationScript.ss b/templates/ValidationScript.ss index 3a0069b..2b5850d 100644 --- a/templates/ValidationScript.ss +++ b/templates/ValidationScript.ss @@ -5,6 +5,14 @@ '{$Name.JS}': '{$ErrorMessage.JS}'<% if not Last %>,<% end_if %><% end_if %><% end_if %><% end_loop %> }; + $(document).on("click", "input.text[data-showcalendar]", function() { + $(this).ssDatepicker(); + + if($(this).data('datepicker')) { + $(this).datepicker('show'); + } + }); + $("#Form_Form").validate({ ignore: ':hidden', errorClass: "required",