Friday, April 20, 2012

Using jQuery to Prefill and Disable Required Columns in a SharePoint Form


<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.4.2.min.js"></script>

2<script language="javascript" type="text/javascript">
3  $(document).ready(function() {
4    $("input[Title='Title']").val("Hello World");
5    $("input[Title='Title']").attr("disabled", "disabled");
6  });
7  
8  function PreSaveAction() {
9    $("input[Title='Title']").attr("disabled", "");
10    return true;
11  }
12</script>
 
 
********************************************************************
 
if you need to know if a specific object is visible:
if ( $('#myitem').is(':visible')){
// perform logic if the item is visible..
}

************************************************

No comments:

Post a Comment