Disable a group of checkboxes

Posted by IramK on 15-Oct-2014 04:13

Hello,

I am trying to disable a group of checkboxes (containing 5 checkboxes) once a 6th checkbox is checked. If the 6th checkbox is unchecked, I would like to re-enable the group of checkboxes. Is there a quick way to do this in Rollbase?

All Replies

Posted by Gian Torralba on 15-Oct-2014 10:38

Hello,

You need to use javascript or JQuery to achieve this. Here is a sample code using JQuery.

<script>
$(document).ready(function(){
    checkIfSet();
});

function checkIfSet(){
    var cb = rbf_isChecked('6th_cb'); /*name of field*/
    
    if(cb){
        $("#rbi_F_5_cb").attr("disabled","disabled"); /*name of field*/
    }
    else{
        $("#rbi_F_5_cb").removeAttr("disabled"); /*name of field*/
    }
}
</script>

You also need to add the function name in the "6th_cb" field event in the object definition page.

Hope this helps,
Gian

Posted by Gian Torralba on 15-Oct-2014 10:39

Please edit the if condition. Please replace  $("#rbi_F_5_cb") with  $("#rbi_F_5_cb input") to disable the input check boxes instead

Thank you,

Gian

This thread is closed