[CLOSED] html Editor - Encoding Decoding Issue

  1. #1

    [CLOSED] html Editor - Encoding Decoding Issue

    When i Passed Encode string through extraparams in properly work in ext.net 1.1 but in ext 2.2 is create issue (automatically decode encoded string)

    ext.net 1.1 get json string format like (in Code behind through Extraparameter)

    [{"value":"xcvxcv","key":"NAME","xtype":"textfield" },{"value":"<FONT style="BACKGROUND-COLOR: #00ffff" size=3>xcvxcvxcvxcv</FONT>","key":"Address","xtype":"htmleditor"}]


    ext.net 2.2 get json string format like (in Code behind through Extraparameter)

    [{"value":"xcvxcv","key":"NAME","xtype":"textfield" },{"value":"<FONT style="BACKGROUND-COLOR: #ff9900" size=3>xcvxcvxcvxcv</FONT>","key":"Address","xtype":"htmleditor"}]

    throw exception in Ext 2.2 After parsing a value an unexpected character was encountered: B. Path '[1].value', line 1, position 76.

    here is code.
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function getSubmitData() {
                var filterInfo = new Array;
                var obj, subobj;
                var xtype = '';
                var value = '';
                var ctl;
                for (i = 0; i < FsEdit.items.length; i++) {
                    ctl = FsEdit.items.items[i];
                    xtype = ctl.xtype;
                    obj = new Object;
                    switch (xtype) {
                        case "htmleditor":
                            //obj.value = Ext.util.Format.htmlEncode(ctl.getValue());
                            obj.value = Ext.String.htmlEncode(ctl.getValue());
                           obj.key = ctl.fieldLabel;
                            break;
                        default:
                            if (ctl.getValue() != null)
                                obj.value = ctl.getValue();
                            else
                                obj.value = "";
                            obj.key = ctl.fieldLabel;
                            break;
                    }
                    obj.xtype = xtype;
    
                    filterInfo.push(obj);
                    obj = null;
                }           
                return Ext.JSON.encode(filterInfo).toString();
             }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="RMS" runat="server" Namespace="">
        </ext:ResourceManager>
        <ext:Viewport runat="server" ID="vpItemAdd" Layout="BorderLayout">
            <Items>
                <ext:FormPanel ID="fpnlEdit" runat="server" Border="false" ButtonAlign="Left" AutoScroll="true"
                    Title="Add Details" BodyPadding="20" Region="Center">
                    <FieldDefaults>
                        <CustomConfig>
                            <ext:ConfigItem Name="LabelWidth" Value="135">
                            </ext:ConfigItem>
                        </CustomConfig>
                    </FieldDefaults>
                    <Items>
                        <ext:FieldSet ID="FsEdit" runat="server" Border="false" Layout="FormLayout">
                            <Items>
                             <ext:TextField runat="server" ID="Txt" Width="500" FieldLabel="NAME">
                                </ext:TextField>
                                <ext:HtmlEditor runat="server" ID="htmlEditor" Width="500" FieldLabel="Address">
                                </ext:HtmlEditor>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                    <BottomBar>
                        <ext:Toolbar ID="Toolbar1" runat="server" StyleSpec="background:#e3f4fc">
                            <Items>
                                <ext:Button ID="btnSave" runat="server" Text="Save" Icon="Disk" Width="100" StandOut="true"
                                    ToolTip="Save">
                                    <DirectEvents>
                                        <Click OnEvent="btnSave_click" Failure="btnSave.setDisabled(true);" IsUpload="true"
                                            FormID="fpnlEdit">
                                            <ExtraParams>
                                                <ext:Parameter Name="config" Value="getSubmitData()" Mode="Raw">
                                                </ext:Parameter>
                                            </ExtraParams>
                                            <EventMask Msg="Loading.." ShowMask="true" CustomTarget="fpnlEdit" Target="CustomTarget" />
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </BottomBar>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    
    
        
    
    public void btnSave_click(object sender, DirectEventArgs e)
    {
           var a = e.ExtraParams["config"];
        foreach (JObject objs in JSON.Deserialize<JArray>(e.ExtraParams["config"].ToString()))
        {
        // Perform Action Using <objs>
        }
    }
    Last edited by Daniil; Aug 13, 2013 at 3:49 AM. Reason: [CLOSED]
  2. #2
    Hi @legaldiscovery,

    I am able to reproduce the problem, but as far as I can see the submitted values with v1 and v2, they are identical for me, both the ones are encoded.

    The problem might be related to the versions of Json.NET being used in v1 and v2. They are different.

    We are investigating further.
  3. #3

Similar Threads

  1. HTML Editor Issue
    By GKG4 in forum 2.x Help
    Replies: 0
    Last Post: May 15, 2012, 6:44 AM
  2. [CLOSED] HTML editor issue
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 16, 2011, 11:09 AM
  3. [CLOSED] HTML editor issue in v1.0
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 06, 2011, 2:23 PM
  4. [CLOSED] [1.0] Issue with encoding Html o xml values with Ext.encode
    By edigital in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Nov 15, 2010, 9:34 AM
  5. irregularity of server side html encoding
    By [WP]joju in forum 1.x Help
    Replies: 2
    Last Post: Dec 22, 2009, 10:54 AM

Posting Permissions