donderdag 10 oktober 2013

Disable a Choice field without knowing the ID of your Sharepoint Field

I'm starting to write my own sharepoint helperclass with functions 
that can be called without knowing the ID's of the Sharepoint Fields, 
but by using the field Display Names. 

This function is to Disable or Enable a Sharepoint Choice Field.

// call the function
// DisableAChoiceField ("DISPLAYNAME", "input|select", True) to disable the field
// DisableAChoiceField ("DISPLAYNAME", "input|select", False) to enable the field
function DisableAChoiceField(titel, type, b_disable)
    if (type == "input")
  var TD = $('nobr:contains("'+ titel + '")').closest("td").next("td").find('input');
    if (type == "select")
  var TD = $('nobr:contains("'+ titel + '")').closest("td").next("td").find('select');
    for(var i = 0; i < TD.length;i++)
  $("#" + TD[i].id).attr("disabled",b_disable);

Geen opmerkingen:

Een reactie posten