Tuesday, July 8, 2014

Change save button to Send - SharePoint list

*This post is for share point beginners.

You may come across the situation where  you need to customize share point form elements.

this is a workaround to change the default “Save” button to “submit” or any word, in the SharePoint list form such as NewForm.aspx without using info path or share point designer.


A]For Share Point 2010 1) In your URL box, after NewForm.aspx (or EditForm.aspx,) add this text: ?toolpaneview=2 Your url should look like "http://mysite.com/mylist/NewForm.aspx?toolpaneview=2"


2) Hit enter. The page will open in Shared editing mode. Choose "Add a Web Part" anywhere on the page.





3) Add a Content Editor Web Part(CEWP). In the Text Source of the Content Editor Web Part, paste the following code:


//code


<script type="text/javascript">

function changeOKButtons()
{
 var inputs = document.getElementsByTagName("input");
 for(i = 0; i<inputs.length; i++)
 {
  if(inputs[i].type == "button" && inputs[i].value == "OK")
   inputs[i].value = "Submit";
 }
}
_spBodyOnLoadFunctionNames.push("changeOKButtons");
</script>

4)save and close. it's done !



B]For Share Point 2013,

1) Open NewForm.aspx
2)click on Edit Page
3)Add a Content Editor Web Part
4)paste following code into it.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>  

<script>  
$(document).ready(function()  
{  
$("input[value$='Save']").attr('value', "Your text here");  
});  
</script>

No comments:

Post a Comment