Change title of new /edit/ view list form

In SharePoint 2010 whenever you do any operation with respect to list like add,view and edit,it open in modal dialog box.

We had one of the requirement as to remove hyphen(-) from the modal title.

1

Edit default new form web part and add content editor web part.

2

create txt file add the below snippet and make refrence to the content editor

<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js”></script&gt;
<script language=”javascript” type=”text/javascript”>

$(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(CustomAction, “sp.js”); });

function CustomAction(){
var oldText= parent.document.getElementById(“dialogTitleSpan”);
var newText=oldText.textContent.split(“-“)[0];
SP.UI.UIUtility.setInnerText(parent.document.getElementById(“dialogTitleSpan”), newText);
}

</script>

Save and close the page.

Now open the add new form it will have title without hyphen

3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s