mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX: disable jquery.validation with date fields
Inconsistent with date locale formats.
This commit is contained in:
parent
c3386b48b2
commit
23963e2a47
@ -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
|
||||
/**
|
||||
* @package userforms
|
||||
*/
|
||||
public function getValidation() {
|
||||
return array_merge(parent::getValidation(), array(
|
||||
'date' => true
|
||||
));
|
||||
class EditableDateField_FormField extends DateField {
|
||||
|
||||
public function Type() {
|
||||
return "date-alt text";
|
||||
}
|
||||
}
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user