I’m constructing a type with elementor professional. I seen that the checkbox fields (not the acceptance) haven’t got a required setting/choice, however I must validate a selected teams of checkboxes, so I began my analysis and I’m at present constructing a validator utilizing jQuery:
operate form_checkboxes_validation(){
?>
<script kind="textual content/javascript">
(operate($){
$("#submit").click on(operate(){
if(! $('#form_id enter[type="checkbox"]').is(':checked')) {
alert("Please verify at the very least one.");
return false;
}
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'form_checkboxes_validation');
Atm, my script validates all of the checkbox fields within the type, even after I used the particular factor ID as a selector for the checkbox area. It appears that evidently elementor adjustments the IDs of the checkboxes within the frontend.
So, for instance if I set the “suite” checkboxes group ID as select_suite
, then within the frontend I see form-field-select_suite-0
I wish to validate solely the “suite” checkboxes teams (picture connected above), since this the one required area for this part of the shape and I want for the submitter to at the very least have one checked from the suites group. The opposite two teams usually are not required.
Any options on learn how to correctly method this?