Clear multiple checkbox

rss

Posted by coresoul - Dec 4 ’15 at 02:18

i have a field with radio button (3 selection)

i have 3 more checkbox fields (multiple selection) associated with this radio buttons. i would like to clear and hide 2 checkbox field one 3rd one is selected..viceversa

i did the hidden part but not able to clear the checkboxes.

help

 

 

function CorporateFields() {

var p = fd.field('DocNeed').control().value();

if (p == 0) {

$('.corpEnt').show(); // Enable

$('.site').hide(); // Disable

$('.dept').hide(); // Disable

}

else if (p == 1) {

$('.corpEnt').hide(); // Disable

$('.site').hide(); // Disable

$('.dept').show(); // enable

}

else if (p == 2) {

$('.corpEnt').hide(); // Disable

$('.site').show(); // enable

$('.dept').hide(); // Disable

}

else {

 

}

}

 

fd.field('DocNeed').control().change(function () {

CorporateFields();

});

 

// Initialize

CorporateFields();

  • rostislav
    rostislav
    Moderator
    Member for: 4 years 11 months
    #1 by rostislav Dec 7 ’15 at 05:46
    To check a particular option in a checkbox control:
    //checkBoxIndex starts with 0
    var checkboxIndex = 2;
    fd.field('MultiChoice').control()._el()
    .find('input[type="checkbox"]').eq(checkboxIndex)
    .prop('checked', true);
    To uncheck all options in a checkbox control:
    fd.field('choice').control()._el()
    .find('input[type="checkbox"]')
    .prop('checked', false);
    To check all options:
    fd.field('choice').control()._el()
      .find('input[type="checkbox"]')
      .prop('checked', true);
    See the following link for information about how to set values on any type of field: http://formsdesigner.blogspot.ru/2013/04/getting-and-setting-sharepoint-form.html
  • schuess
    schuess
    Member
    Member for: 6 years 2 months 13 days
    #2 by schuess Dec 18 ’15 at 02:45

    [#1]: What about if you want to verify that at least 1 checkbox is checked. Say you have 3 options, and you want to make sure they have selected at least 1 or more?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 6 months 16 days
    #3 by Dmitry Kozlov Dec 21 ’15 at 05:49

    [#2]: Use this code:

    if (fd.field('Choice').value().length == 0) {
        alert('Please, fill-in the choice field.');
        return false;
    }
    
Displaying 1 to 3 of 3 messages