class CvWebformDecimalCommaValidator in Clientside Validation 7.2
Hierarchy
- class \ClientsideValidationValidator
- class \CvWebformValidator
Expanded class hierarchy of CvWebformDecimalCommaValidator
1 string reference to 'CvWebformDecimalCommaValidator'
- webformdecimalcomma.inc in clientside_validation_webform/
plugins/ validator/ webformdecimalcomma.inc
File
- clientside_validation_webform/
plugins/ validator/ webformdecimalcomma.inc, line 10
View source
class CvWebformDecimalCommaValidator extends CvWebformValidator {
public function supports(array $element, array &$form_state) {
if (!parent::supports($element, $form_state)) {
return FALSE;
}
return $element['#webform_component']['type'] == 'number' && !$element['#webform_component']['extra']['integer'] && $element['#webform_component']['extra']['point'] == ',';
}
public function getJavascriptSettings(array &$element, array &$form_state) {
$name = $this
->getName($element);
return array(
'rules' => array(
$name => array(
'numberDE' => TRUE,
),
),
'messages' => array(
$name => array(
'numberDE' => $this
->getMessage($element),
),
),
);
}
public function getMessage(array $element) {
return t("!title field accepts only numbers (use a ',' as decimal point).", array(
'!title' => $element['#title'],
));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ClientsideValidationValidator:: |
public | function | 1 | |
ClientsideValidationValidator:: |
public | function | 27 | |
ClientsideValidationValidator:: |
public | function | 7 | |
ClientsideValidationValidator:: |
public | function | 3 | |
CvWebformDecimalCommaValidator:: |
public | function |
Overrides ClientsideValidationValidator:: |
|
CvWebformDecimalCommaValidator:: |
public | function |
Overrides ClientsideValidationValidator:: |
|
CvWebformDecimalCommaValidator:: |
public | function |
Overrides CvWebformValidator:: |