jyou
June 7, 2021, 6:06pm
1
Hi there,
I have a checkbox selection implemented as below:
And sharepoint column created as below:
However, I only want to be able to select one selection, so when I select on one of the checkboxes, the other two checkboxes are disabled.
How do I achieve that in JavaScript?
Thanks,
Hello @jyou ,
You can change the display choices property to Radio Buttons, thus a user can only select one option.
And no code is required.
jyou
June 8, 2021, 2:38pm
3
hi @mnikitina ,
Unfortunately, the program I am working on doesn't support Radio Buttons. So I am wondering I can write code to limit to one selection only for the checkboxes? Thanks.
@jyou ,
You can try out this code:
var options = $(fd.field('MultiChoice').$el).find('input[type="checkbox"]')
options.click(function(){
var selectedOption = $(this).attr("value");
fd.field('MultiChoice').value = [];
fd.field('MultiChoice').value.push(selectedOption)
});
jyou
June 10, 2021, 7:25pm
5
Hi @mnikitina ,
It works for me now. Thanks a bunch
1 Like