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

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.