1.Comment default SharePoint Save button
<!--<SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/> -->
2.Place one html input button as like following
<input type="button" value="Save & mail" name="Save" onclick="if(!PreSaveAction())return true;{ddwrt:GenFireServerEvent('__commit;__redirect={../../SitePages/Views/default.aspx}')};" />
3.Write PreSaveAction method as follows
<script type="text/javascript">
function PreSaveAction(){
Repeat Step 4 // PresaveAction we can set default values to sharepoint controls
return true;
}
<scrip>
4.PresaveAction we can set default values to sharepoint controls
var CurrentUser= $().SPServices.SPGetCurrentUser({ fieldName: "Title", debug: false });
$("input[title='From']").val(CurrentUser)
In the above we are getting the Current User Name and set to From field Value in the respective List
No comments:
Post a Comment