0

Using SharePoint REST API, have a Bootstrap/HTML form that has about 20 questions, each with it's own group of checkboxes, and I'm trying to both Get and Post the values from the "checked" boxes. I can get one of the checkbox values of a group to post but not all.

I'm also unsure how to get the checkboxes to be checked on Get, example when a user opens the form for an existing record the right checkboxes should be checked.

What I've tried

var checkedV = $('input[name="q1error"]:checked').map(function() {
return $(this).value();
}).get();

'q1e': $('input:checkbox[name="q1error"]:checked').val()
'q1e':$('input[name="q1error"]').val(arrayValues)

HTML Sample

<div class="form-group my-2">
    <label>1. Some question?</label>
    <div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input qOne" id="q1y" name="q1" value="Yes"></input>
        <label class="custom-control-label" for="q1y">Yes</label>
    </div>
    <div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input qOne" id="q1n" name="q1" value="No"></input>
        <label class="custom-control-label" for="q1n">No</label>
    </div>
    <div class="errorAll errorQone">
        <div class="mt-1 mb-1 qOneSub">If no, then identify which issues below</div>
        <div class="custom-control custom-checkbox mb-1 qOneSub">
            <input type="checkbox" class="custom-control-input" id="errorQ1a" name="q1error" value="a"></input>
            <label class="custom-control-label" for="errorQ1a">a</label>
        </div>
        <div class="custom-control custom-checkbox mb-1 qOneSub ">
            <input type="checkbox" class="custom-control-input" id="errorQ1b" name="q1error" value="b"></input>
            <label class="custom-control-label" for="errorQ1b">b</label>
        </div>
    </div>
</div>

Your Answer

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

Browse other questions tagged or ask your own question.