Select all checkboxes

In our app we have an "Add" form with a few fields and a connection field (many). The choices are represented by checkboxes instead of a dropdown menu. We would like to be able to select a "select all" option/button/link to select all the checkboxes. We've seen a lot of javascript examples but we don't know how to translate them into our app. We would love your help!

 Hey, was anyone able to get this working on first click? I'm seeing the same issues

I see the same symptoms as this, it's difficult to tell whether this selects all options or not as they are not saved.

Thanks so much! It doesn't quite seem to work for me - when I press "select all", it selects all the boxes, but when i press "submit" on my form, the record doesn't seem to be updated. When I re-open the form I find all the boxes still checked (except the "select all" box), and then I press submit again, it and now it seems to update. Any ideas why?

 we did it!

// add the checkbox to the form

$(document).on(‘knack-scene-render.scene_109’, function(event, scene) {

$('#view_181 .conn_inputs').before('<div class="conn_inputs" id="select"><input type="checkbox"> Select all</input></div>');

$(’#select’).change(function() {

$('.view_181 .conn_inputs input').each(function() {
  $(this).attr('checked', $('#view_181 .conn_inputs input').attr('checked') != undefined);
 
});

});
});