Wednesday, February 25, 2009
Tuesday, February 17, 2009
SP JS
<script type="text/javascript" language="javascript">
function PreSaveAction()
{
var date1 = getFieldAttribute("INPUT","DateTimeFieldDate","Start Time");
var date2 = getFieldAttribute("INPUT","DateTimeFieldDate","End Time");
var arrDate1 = date1.value.split("/");
var useDate1 = new Date(arrDate1[2], arrDate1[1]-1, arrDate1[0]);
var arrDate2 = date2.value.split("/");
var useDate2 = new Date(arrDate2[2], arrDate2[1]-1, arrDate2[0]);
if(useDate1 > useDate2)
{
alert("Please select valid End Date");
return false; // Cancel the item save process
}
return true; // OK to proceed with the save item
}
function getFieldAttribute(tagName, identifier, title)
{
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i=0; i < tags.length; i++)
{
var tempString = tags[i].id;
if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
return tags[i];
}
}
</script>
<script type="text/javascript" language="javascript">
function makeReadOnly()
{
var firstName = document.getElementById("urn:schemas-microsoft-com:office:office#FirstName");
var elements = document.body.getElementsByTagName("*");
for(index=0; index<elements.length; ++index)
{
if(elements[index].title == "Title")
{
elements[index].readOnly = true;
alert("Title");
}
}
}
_spBodyOnLoadFunctionNames.push("makeReadOnly()");
</script>
HCFPT-K86VV-DCKH3-87CCR-FM6HW
Subscribe to:
Posts (Atom)