none
Field display name modification in list newform using CSR(JS links) RRS feed

  • Question

  • Hi All,

    I would like to modify the display name of the field in the new form in the list using JS links. For example, my field name is "Name" in the new form. I want display this filed as "My First name". I want achieve this functionality using JS links. Your help will be appreciated.

    Thanks in advance,

    Nag

    Friday, April 28, 2017 1:20 AM

Answers

  • Hi,

    Please follow the steps below:

    1. Save the following code as a js file(changeDisplayName.js).

    (function () {
    	(window.jQuery || document.write('<script src="//code.jquery.com/jquery-3.1.0.min.js"><\/script>')); 
    	var ctxForm = {};
    	ctxForm.Templates = {};
    	ctxForm.OnPostRender = postFormRenderer;
    	SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    
    	function postFormRenderer(overrideCtx) {
    		$(".ms-standardheader nobr").each(function(){
    			if($(this).text()=="Name"){
    				$(this).text("My First name");
    			}
    		});        
        }
    })();

    2. Upload the js file into Site Assets document library.

    3. Edit the new form page, and add the following refer in JSLINK.

    ~site/SiteAssets/changeDisaplyName.js

    4. Save it.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, May 1, 2017 2:52 AM
    Moderator

All replies

  • Hi,

    Please follow the steps below:

    1. Save the following code as a js file(changeDisplayName.js).

    (function () {
    	(window.jQuery || document.write('<script src="//code.jquery.com/jquery-3.1.0.min.js"><\/script>')); 
    	var ctxForm = {};
    	ctxForm.Templates = {};
    	ctxForm.OnPostRender = postFormRenderer;
    	SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    
    	function postFormRenderer(overrideCtx) {
    		$(".ms-standardheader nobr").each(function(){
    			if($(this).text()=="Name"){
    				$(this).text("My First name");
    			}
    		});        
        }
    })();

    2. Upload the js file into Site Assets document library.

    3. Edit the new form page, and add the following refer in JSLINK.

    ~site/SiteAssets/changeDisaplyName.js

    4. Save it.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, May 1, 2017 2:52 AM
    Moderator
  • Hi,

    Any update?

    If my reply helps you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, May 8, 2017 4:54 AM
    Moderator