Skip to content

Instantly share code, notes, and snippets.

@durgesh97025
Created March 24, 2017 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save durgesh97025/21aeddc08842684f3b50183abee03f2b to your computer and use it in GitHub Desktop.
Save durgesh97025/21aeddc08842684f3b50183abee03f2b to your computer and use it in GitHub Desktop.
Field Disable/Enable for NewForm/EditForm
//https://msdn.microsoft.com/en-us/library/office/dn600182.aspx#bk_FieldSetShowInNewForm
//https://msdn.microsoft.com/en-us/library/office/jj838353.aspx
//<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
//<script>
$(document).ready(function(){
var url = "https://unicef.sharepoint.com/teams/DFAM/BudgetSection/_api/web/Lists/getByTitle('XXX')/Fields(guid'XXX')/setShowInNewForm(false)";
$.ajax({
url: url,
contentType: "application/json;odata=verbose",
type: "POST",
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: successHandler,
error: errorHandler
});
function successHandler(data,message,response){
console.log(data);
console.log(message);
console.log(response);
}
function errorHandler(a,b,c){
console.log(a);
console.log(b);
console.log(c);
}
});
//</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment