0

I am building a Custom html form and saving all the fields to a SharePoint Online list. I figured out adding text boxes and choice drop downs via JS/jQuery like,

var xxxxxxxx = $("#xxxxxxxx").val();

var yyyyyyyy = $("#yyyyyy").find("option:selected").text();

but can't figure out how to add HTML Checkbox (Yes/No) to a SharePoint Yes/No column.

Please suggest.

Thanks

5
  • Sharepoint yes/no fields are a boolean, meaning it’s true or false. (1/0). Commented Oct 28, 2019 at 18:47
  • Tried this, if ($("#HtmlFieldId").is(':checked') === true) { oListItem.set_item('SPColumnInternalName', '1'); }. Didn't work. Any suggestion? Commented Oct 28, 2019 at 20:06
  • Tried 1 and Yes, Both don't work. Am i doing anything wrong? Commented Oct 28, 2019 at 20:26
  • Try true/false. Commented Oct 29, 2019 at 7:33
  • true worked for me. Thanks Chris Commented Oct 29, 2019 at 15:06

1 Answer 1

1

For SharePoint Checkbox (Yes/No) column, it sholuld be $("#checkboxId").is(':checked').

As you can see the picture:

enter image description here

If you want to set the check box field value, it should be like this:

 $("#checkboxId").attr('checked', true)
1
  • Hello Michael Han, thanks for your response. I was trying to set the SharePoint column, so i tried this if ($("#HtmlFieldId").is(':checked') === true) { oListItem.set_item('SPColumnInternalName', 'true'); } worked for me Commented Oct 29, 2019 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.