cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
furstlars
Nintex Newbie

How Do I Disable A Radio Button Control (List Lookup) if Checked Buttons == 2

What's wrong with my code?

 

var BannerCodeCB = NWF$('#' + BannerCode);

BannerCodeCB.click(function() {
    if(NWF$('#' + BannerCode).filter(':checked').length == 2)
        NWF$('#' + BannerCode).find(":input:not(:checked)").attr("disabled", true);
    else
        NWF$('#' + BannerCode).removeAttr("disabled");
});

 

Labels: (1)
Tags (2)
0 Kudos
Reply
3 Replies
nico
Nintex Newbie

Re: How Do I Disable A Radio Button Control (List Lookup) if Checked Buttons == 2

If I understand, you want to disable you choices (Check box) if the user select more than 1 item ?

So, when the user save the forms, you don't have more than 1 element.

 

You can do that without JavaScript. Create a Nintex Validation Rule, which invalidate your field if there is more dans 1element (and dispay an Error message). So if the user want to save the form, He must unselect some choices.

 

 

0 Kudos
Reply
furstlars
Nintex Newbie

Re: How Do I Disable A Radio Button Control (List Lookup) if Checked Buttons == 2

No I would like to disable all other unchecked choices when 2 checkboxes have been ticked. The idea is to prevent users from ticking more checkboxes when ticked checkbox count == 2.

 

I do not wish to invalidate the entire control.

 

This can only be done via JS.

 

0 Kudos
Reply
allan
Nintex Newbie

Re: How Do I Disable A Radio Button Control (List Lookup) if Checked Buttons == 2

In fact, the solution described by Nicolas works fine: you cannot submit your form if you have more than 2 items selected. If you select 3, you will have the validation rule triggered, preventing you to save the form.
He just answered with 1 items instead of 2, but the solution is still valid.
I suppose that this solution does not suit you because it is check at the page validation and not dynamically ?

0 Kudos
Reply