Fix logic for radio buttons

parents only works if you have a single radio group with conditionals.
closest is what we want.
This commit is contained in:
Derek Kaijser 2017-03-02 11:58:39 +13:00 committed by GitHub
parent e0d9399654
commit 3d8f5d1406

View File

@ -517,7 +517,7 @@ class UserDefinedForm_Controller extends Page_Controller
$expression = '$(this).prop("checked")'; $expression = '$(this).prop("checked")';
} elseif ($radioField) { } elseif ($radioField) {
// We cannot simply get the value of the radio group, we need to find the checked option first. // We cannot simply get the value of the radio group, we need to find the checked option first.
$expression = '$(this).parents(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"'; $expression = '$(this).closest(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
} else { } else {
$expression = '$(this).val() == "'. $rule->FieldValue .'"'; $expression = '$(this).val() == "'. $rule->FieldValue .'"';
} }