Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As far as I can tell, the FAPI range rule is not supported by clientside validation. Is that correct?
It works for me as FAPI validation, but a clientside rule is not generated, even though other FAPI rules are applied just fine.
Adding this to clientside_validation_fapi.module works for me (based on webform implementation):
case 'fapi_validation_rule_range':
$range = array('min' => NULL, 'max' => NULL);
$min = isset($params[0]) ? $params[0] : '';
$max = isset($params[1]) ? $params[1] : '';
if ($min != '' && is_numeric($min)) {
$range['min'] = (int) $min;
}
if ($max != '' && is_numeric($max)) {
$range['max'] = (int) $max;
}
_clientside_validation_set_minmax($name, $title, $range['min'], $range['max'], $js_rules);
break;
Comment | File | Size | Author |
---|---|---|---|
#5 | clientside_validation-fapi_range_rule-2231963-5.patch | 1.22 KB | sdrycroft |
#3 | clientside_validation-fapi_range_rule-2231963-3.patch | 1.21 KB | bgilhome |
Comments
Comment #1
amberau79 CreditAttribution: amberau79 commentedComment #2
attiks CreditAttribution: attiks commentedCan you provide a patch, instructions can be found at https://drupal.org/node/707484
Comment #3
bgilhome CreditAttribution: bgilhome commentedHere's a patch against current 7.x-1.x branch.
Comment #4
bgilhome CreditAttribution: bgilhome commentedComment #5
sdrycroft CreditAttribution: sdrycroft at Cancer Research UK commentedThe previous patch did not allow the use of a custom message. The attached patch (which is a very very minor tweak) does.