dinsdag 8 oktober 2013

Disable a Date 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. 

My first function isn't complete yet.
Disable or Enable a Date Field.
It will be completed very soon with the type "DateTime". 


// call the function
// DisableDateField ("DISPLAYNAME", "Date", True) to disable the field
// DisableDateField ("DISPLAYNAME", "Date", False) to enable the field
  
function DisableDateField (titel, type, b_disable)
{
    if (type == "Date")
 {
        $(':input[title="'+titel+'"]').attr("disabled",b_disable);
        if (b_disable)
            $(':input[title="'+titel+'"]').closest("td").next("td").hide();       
        else
   $(':input[title="'+titel+'"]').closest("td").next("td").show();
 }
}
 

Geen opmerkingen:

Een reactie posten