0
votes

In sitecore page editor Mode the text of button is going weird; i am getting this text from sitecore dictionary. Look at the html of input field value in Page editor mode

<input 
    id='fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063' 
    class='scFieldValue'  
    name='fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063' 
    type='hidden' 
    value="Sign Up" 
/>

<span class="scChromeData">
{ "commands": 
    [
        { "click": "chrome:common:edititem({command:\"webedit:open\"})",
          "header": "Edit the related item",
          "icon": "/temp/IconCache/SoftwareV2/16x16/cubes_blue.png",
          "disabledIcon": "/temp/cubes_blue_disabled16x16.png",
          "isDivider": false,
          "tooltip": "Edit this item in the Content Editor.",
          "type": "common"
        },
        { "click": "chrome:rendering:personalize({command:\"webedit:personalize\"})",
          "header": "Personalize","icon":"/temp/IconCache/PeopleV2/16x16/users3_edit.png",
          "disabledIcon": "/temp/users3_edit_disabled16x16.png",
          "isDivider": false,
          "tooltip": "Personalize component.",
          "type": "sticky"
        },
        { "click": "chrome:rendering:editvariations({command:\"webedit:editvariations\"})",
          "header": "Edit variations",
          "icon": "/temp/IconCache/SoftwareV2/16x16/breakpoints.png",
          "disabledIcon": "/temp/breakpoints_disabled16x16.png",
          "isDivider": false,
          "tooltip": "Edit the variations.",
          "type": "sticky"
        }
    ],
    "contextItemUri":"sitecore://master/{148D7F08-5F66-448D-9123-45030DDBBEBC}?lang=en&ver=1",
    "custom":{},
    "displayName":"Phrase",
    "expandedDisplayName":null
}
</span>
<span scFieldType="memo" 
      contenteditable="true" 
      class="scWebEditInput"  
      id="fld_148D7F085F66448D912345030DDBBEBC_2BA3454A9A9C4CDFA9F8107FD484EB6E_en_1_3f45b5b727dc4c93a537e7f688aa6808_1063_edit">
Sign Up
</span>

In normal mode input field value is Just "Sign Up".

This is only happening in the combination of button + page editor.

Might be helpful if i give my code which gets dictionary item from sitecore

public static string GetDictionaryItem(string expression)
    {
        string val = String.Empty;
        Item currentItem = Context.Database.GetItem(String.Concat("/sitecore/system/dictionary",expression));
        if (currentItem != null)
        {
            val = FieldRenderer.Render(currentItem, "Phrase");
        }
        return val;
    }

Any suggestions??

1
You should post the markup of the rendering (i.e. show us how you are rendering that button).Ruud van Falier
Can you check if you have <form method="post" runat="server" id="mainform" > on page ? I see a similar issue,and adding form tag help me.user459491
Thanks, Thought of same thing. updated the postDheeraj Palagiri

1 Answers

3
votes

Well, it does what it's supposed to do...
You return a FieldRenderer, so if you're in Page Editor mode it will render an editable field instead of just the text.

If you want just the text in all rendering modes, then change your method to:

public static string GetDictionaryItem(string expression)
{
    Item currentItem = Context.Database.GetItem(String.Concat("/sitecore/system/dictionary",expression));

    if (currentItem != null)
    {
        return currentItem["Phrase"] ?? string.Empty;
    }

    return string.Empty;
}