Crow Canyon Software Forum
MultiSelect with checkboxes
Quote from mkirby on August 30, 2021, 11:03 amI have a SharePoint choice field that allows multiple selections so it's displayed as checkboxes. I figured it was a KendoMultiSelect in the rendered HTML but I have done nothing with Kendo to know exactly how to address the checkboxes and set/unset them. I need the buttons on the right to select the appropriate days, or all days, meals. Can you help me with some javascript?
I have a SharePoint choice field that allows multiple selections so it's displayed as checkboxes. I figured it was a KendoMultiSelect in the rendered HTML but I have done nothing with Kendo to know exactly how to address the checkboxes and set/unset them. I need the buttons on the right to select the appropriate days, or all days, meals. Can you help me with some javascript?
Uploaded files:Quote from mkirby on August 30, 2021, 1:06 pmI was able to do it with standard HTML jquery selectors. Thanks.
i.e.:
$("#BtnSelectDay7").on("click", function(e){
e.preventDefault();
var items = $("input[value^='Day 7 ']");
var itemIds = ["Breakfast","Lunch","Dinner"];
for(var i=0;i < items.length;i++){if($("input[value='Day 7 "+itemIds[i] + "'").is(":checked")) {
$("input[value='Day 7 "+itemIds[i] + "'").prop("checked", false);
} else {
$("input[value='Day 7 "+itemIds[i] + "'").prop("checked", true);
}
}
});
I was able to do it with standard HTML jquery selectors. Thanks.
i.e.:
$("#BtnSelectDay7").on("click", function(e){
e.preventDefault();
var items = $("input[value^='Day 7 ']");
var itemIds = ["Breakfast","Lunch","Dinner"];
for(var i=0;i < items.length;i++){
if($("input[value='Day 7 "+itemIds[i] + "'").is(":checked")) {
$("input[value='Day 7 "+itemIds[i] + "'").prop("checked", false);
} else {
$("input[value='Day 7 "+itemIds[i] + "'").prop("checked", true);
}
}
});
Quote from James Restivo on August 31, 2021, 12:28 pmExcellent! Thank you for the update and for sharing your solution!
Excellent! Thank you for the update and for sharing your solution!