In SharePoint List, I have create Check boxes with three option in Choice Column.

Now, How to disable two options when one is selected in new form?

I tried by using this Link, but no use.


We can use Radio Buttons field to instead of Checkboxes field.

If you still want to use Checkboxes, we can add the following code to script editor web part(2013/online) or Content Editor Web part(2010/2013/Online) in new form page to achieve it. Note: Modify the field column name in the code below.

<script src="//code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function PreSaveAction(){
    var columnName="Checkboxes";
    if($(".ms-standardheader nobr:contains('"+columnName+"')").closest("tr").find("input[type='checkbox']:checked").length>1){
        alert("Only 1 selection allowed.");
        return false;
        return true;

enter image description here

  • I already tried this, but not working – san Jan 1 '18 at 8:26
  • I modify the code above, don't forget modify the "columnName" in the code. – LZ_MSFT Jan 3 '18 at 3:03

You can try this

<script type="text/javascript" src="/Javascript/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/Javascript/LimitSelectionsInCheckboxes.js"></script>
<script type="text/javascript">
initLimitSelections('YourFieldInternalName',1,'Only 1 selections allowed.');

Code in LimitSelectionsInCheckboxes.js

var multiChoiceFields = init_multiChoiceFields();

function initLimitSelections(FieldInternalName,allowedSelections,errorText){
    if(typeof errorText === "undefined" || errorText === ""){
        errorText = "You can only select " + allowedSelections + " options.";

function limitSelections(currOpt,fin,n,errText){
    var f = $(multiChoiceFields[fin]), c, chk;
    c = f.find("input:checked").length;
    // If allowedSelections = 1 move selection
    if(n === 1){
        chk = currOpt.prop("checked");
        // Uncheck current selection and give user a visual feedback on number of allowed selections
        if(c > n){
            f.find("td[class^='ms-formbody']").append("<div id='customMultiSelectValidation' class='ms-formvalidation'>" + errText + "</div>");

function init_multiChoiceFields(){
    var res = {}, myMatch, disp, fin, type;
    myMatch = $(this).html().match(/FieldName="(.+)"\s+FieldInternalName="(.+)"\s+FieldType="(.+)"\s+/);    
            // Display name
            disp = myMatch[1];
            // FieldInternalName
            fin = myMatch[2];
            // FieldType
            type = myMatch[3];
            // Build object
            res[fin] = this.parentNode;
    return res;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.