Loading...

Wednesday, January 18, 2012

Validation for New Form and Sharepoint:SPSecurityTrimmedControl

PreSaveAction is the Inbuilt function available in OOB NewForm.aspx of the Lists.It is already defined in core.js. It comes to rescue for fast customization of NewForm.aspx and OOB Webparts like Calendar .It also helps for validation for attachments in ListItem.
Following example helps to refresh the page when New event is added to Calendar.Shortly I will be writing the post on Calendar customization.

<script type="text/javascript">
//window.location.reload();

function PreSaveAction()
{
window.parent.location.href = '_layouts/AccessDenied.aspx';
return true;
}
</script>
//Admins will be able to add the events from DayView of Calendar
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageWeb">
<script type="text/javascript">
//window.location.reload();

function PreSaveAction()
{
window.parent.location.href = '..SitePages/Home.aspx';
return true;
}
</script>

</SharePoint:SPSecurityTrimmedControl>

No comments: