javascript - How to bind checkboxes from custom form into SharePoint? -


I am using javascript to get all the checkboxes with the name "checkbox", checked that key An array is examined.

The HTML check box looks like this:

  & lt; Input type = "checkbox" name = "day" value = "Sunday" /> Sunday & lt; Input type = "checkbox" name = "day" value = "Monday" /> Monday  

My script, which puts all checked values ​​into an array, looks like:

  var arr = new array (); $ ('Input [name = "day"]: checked'). Each (function () {arr.push ($ (this) .val ());}); Return arr;  

When I hit "submit" (I am using Form 7), then it is added to the SharePoint list.

However, by the time I try to edit that list item, all the checkboxes are unselected. For example, if I checked 'Sunday' when I made a list item, it will not be checked when editing it.

Any ideas on how checkbox binding works in SharePoint?

I understood it as a separator for SharePoint array objects "," "< / Code> instead of "; # ".

For example, this is - if I check the checkbox with values ​​(" one "," two "," three ") and list I submit the item:

  var arr = new array (); arr.push ("a"); arr.push ("two"); arr.push ("three") ;  

Normally, arr.toString () JavaScript will have the following results:

  one, two, three < / Code> 

But with SharePoint, this is what recognizes it:

  a; #two; #three  

That's why I had to use it arr When changing the list item, the checkbox ("one", "two", "three") are still checked to change the commons. .join ("; #"); >


Comments