0

We had one list name as "Data" with columns. under list, one column (Access) we need to fix with default data(URL). means when user click on "New Item", access column data must be default URL. And also in place of URL column, can we put image or button. So when user click on default "Access" column, it will open new form.

Please suggest, how to achieve with SharePoint designer 2013.

1

We can use JSLink to replace the "Access" hyperlink column with a button column, and click the button we can open the url in new tab. Add the code below into a script editor web part into the list view page.

<script type="text/javascript">
(function () { 
    // Create object that have the context information about the field that we want to change it's output render  
    var fieldContext = {}; 
    fieldContext.Templates = {}; 
    fieldContext.Templates.Fields = { 
        // Apply the new rendering for Available field on List View 
        "Access": { "View": fieldTemplate } 
    }; 
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(fieldContext);
})(); 

// This function provides the rendering logic for list view 
function fieldTemplate(ctx) { 
    var url= ctx.CurrentItem["Access"];
    var desc=ctx.CurrentItem["Access.desc"];
    if(url==""){
        url="allitems.aspx";
        desc="All Items";
    }
    return "<button onclick='window.open(\""+url+"\",\"_blank\")'>"+desc+"</button>";   
}
</script>

enter image description here

The "Access" field settings.

enter image description here

  • Thanks for response. I had applied your code, button came on list but it showing as "undefined". When click on button, opening new empty page. I need to insert URL for that button. Could you please suggest me or correct me i am doing wrong. – murali kuruva Mar 25 at 14:13
  • Make sure the "Access" field is a hyperlink column. – LZ_MSFT Mar 26 at 1:13
  • Thanks again response. How to fix default link for Access filed. Means hyperlink url common for all items, so we need to fix on default URL for access field column in list, Please suggest us. – murali kuruva Mar 26 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.