I have a Form that includes two radio inputs both based on this field structure:
<field name="privacy_policy"
type="radio"
layout="joomla.form.field.radio.switcher"
default="0"
required="true"
validate="ValidateChecked"
class="validate-checked"
label="COM_COMPONENTNAME_FIELD_PRIVACY_STATUS_LABEL"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
And the Rule JS:
document.addEventListener('DOMContentLoaded', function() {
document.formvalidator.setHandler("checked", function (value, element) {
console.log(element)
console.log(value)
return value == "1";
});
});
The rule gets called like so on save BUT its called twice (once for the option no and once for the option yes. This means the form does not get submitted. So how can I implement a check to make sure the Radio was switched to yes?