/** * Return the form field * */ public function getFormField() { $defaultValue = $this->getSetting('DefaultToToday') ? date('Y-m-d') : $this->Default; $field = new EditableDateField_FormField($this->Name, $this->Title, $defaultValue); $field->setConfig('showcalendar', true); return $field; }
/** * Return the form field * */ public function getFormField() { $defaultValue = $this->DefaultToToday ? SS_Datetime::now()->Format('Y-m-d') : $this->Default; $field = EditableDateField_FormField::create($this->Name, $this->EscapedTitle, $defaultValue)->setConfig('showcalendar', true)->setFieldHolderTemplate('UserFormsField_holder')->setTemplate('UserFormsField'); $this->doUpdateFormField($field); return $field; }
/** * Return the form field * */ public function getFormField() { $defaultValue = $this->getSetting('DefaultToToday') ? date('Y-m-d') : $this->Default; $field = EditableDateField_FormField::create($this->Name, $this->Title, $defaultValue); $field->setConfig('showcalendar', true); if ($this->Required) { // Required validation can conflict so add the Required validation messages // as input attributes $errorMessage = $this->getErrorMessage()->HTML(); $field->setAttribute('data-rule-required', 'true'); $field->setAttribute('data-msg-required', $errorMessage); } return $field; }