locked
Search display template RRS feed

  • Question

  • I have the below code to display the clickable Display text 

    <td class="ms-cellstyle ms-vb2">
                        <!--#_
                                var clickType = ctx.CurrentItem.csr_ClickType;
                                if(!clickType) {clickType = "Result";}
                                var appAttribs = "";
                                if (!$isEmptyString(ctx.CurrentItem.csr_OpenApp)) { appAttribs += "openApp=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenApp) + "\""; };
                                if (!$isEmptyString(ctx.CurrentItem.csr_OpenControl)) { appAttribs += " openControl=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenControl) + "\""; };
    
                                var taskContainerHyperlinkDescription = ctx.CurrentItem.HyperlinkDescription;
                                var taskContainerHyperlink =  $htmlEncode($getItemValue(ctx, "Hyperlink"));
                                var taskContainerHyperlinkText;
    
                                if($isEmptyString(taskContainerHyperlinkDescription)) {
                                    taskContainerHyperlinkText = $htmlEncode($resource("TaskContainerLinkString"));
                                } else {
                                    taskContainerHyperlinkText = $htmlEncode(taskContainerHyperlinkDescription);
                                }
                                processHyperlink = String.format('<a clicktype="{0}" href="{1}" class="ms-srch-item-link" style="font-size:1.15em" title="{2}" onfocus="{3}" {4}>{5}</a>',
                                                    $htmlEncode(clickType), $urlHtmlEncode(taskContainerHyperlink), taskContainerHyperlink,
                                                    ctx.currentItem_ShowHoverPanelCallback, appAttribs, taskContainerHyperlinkText );
                                var description = processHyperlink;
    
                        _#-->
                        _#= description =#_
     </td>

    The problem is when the description has comma then its displaying the text after the comma. For example if the description is like this "Hello,World,Description" then its displaying the "description" alone. I don't know where and why the delimiter cutting is happening ?. 

    Wednesday, December 6, 2017 10:29 AM

All replies

  • Hi,

    In my environment, it’s ok.

    Screenshot of result.

    I think there may have some problems in your JS code, Please debug to check it.

    Best regards,

    Lee Liu


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

    Thursday, December 7, 2017 10:20 AM
  • Thank you for your reply Lee. the problem was from CPES. Its solved.
    Wednesday, December 13, 2017 9:20 AM
  • Hi,

     

    As you have solved this issue, please mark your reply as an answer, it will benefit with others in the community who meet this similar issue in the future.

    Best regards,

    Lee Liu


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

    Wednesday, December 13, 2017 9:23 AM