id(); $val = $this->attrValue(); $day = $month = $year = null; if( preg_match( '/^\d{2}\/\d{2}\/\d{4}$/', $val ) ) { $dateArray = explode( '/', $val ); $val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0]; } if($val) { $dateArray = explode( '-', $val ); $day = $dateArray[2]; $month = $dateArray[1]; $year = $dateArray[0]; } if(preg_match('/(.*)[(.+)]$/', $this->name, $fieldNameParts)) { $fieldNamePrefix = $fieldNameParts[1]; $fieldName = $fieldNameParts[2]; } else { $fieldNamePrefix = $this->name; $fieldName = $this->name; } return << / /
HTML; } function jsValidation() { if(Validator::get_javascript_validator_handler() == 'none') { return ''; } $formID = $this->form->FormName(); $error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format (DD/MM/YYYY).'); $error = 'Please enter a valid date format (DD/MM/YYYY) from dmy.'; $jsFunc =<< 0 && !value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/([0-9][0-9]){1,2}\$/)) { validationError(_CURRENT_FORM.elements[fieldName+'[Day]'],"$error","validation",false); return false; } return true; } } }); JS; Requirements :: customScript($jsFunc, 'func_validateDMYDate_'.$formID); // return "\$('$formID').validateDate('$this->name');"; return <<name') \$('$formID').validateDMYDate('$this->name'); }else{ \$('$formID').validateDMYDate('$this->name'); } } JS; } } ?>