getValue() of htmlEditor issue

  1. #1

    getValue() of htmlEditor issue

    Hello,

    I've been wracking my brains for 2 days trying to figure out why I cannot correctly get the content of my htmlEditor control. I've browsed the forums and tried a good 4 or 5 different solutions that have no effect. I am trying to get the content of the htmlEditor and post it to the database. Here is my setup:

    aspx:
                <ext:Panel ID="pEmailEditor" runat="server" Region="East">
                    <Items>
                        <ext:FieldSet ID="FieldSet1"
                            runat="server"
                            Title="Edit Template"
                            Layout="AnchorLayout"
                            DefaultAnchor="100%">
                            <Items>
                                <ext:HtmlEditor ID="eEmail"  
                                    runat="server"
                                    Width="610" 
                                    Height="500"
                                    EnableAlignments="false"
                                    EnableFontSize="false">
                                    <Listeners>
                                    </Listeners>
                                </ext:HtmlEditor>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="pSubmit" runat="server" Region="South">
                    <Items>
                        <ext:FormPanel ID="FormPanel1"
                            runat="server"
                            Frame="true"
                            Layout="AnchorLayout" Region="East">
                            <Items>
                                <ext:Button ID="bSubmitTemplate" 
                                    runat="server" 
                                    Text="Submit Template"
                                    Margin="10" X="600">                              
                                    <Listeners>
                                        <Click Handler="
                                            Ext.net.DirectMethod.request({
                                                url : '/Home/SubmitTemplate/',
                                                params : {
                                                    text : #{eEmail}.getValue()
                                                }
                                            });
                                        " />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:FormPanel>
                    </Items>
                </ext:Panel>
    Here's my controller method i'm trying to call in the Button Click Event (/Home/SubmitTemplate)
        Public Function SubmitTemplate(ByVal text As String) As ActionResult
            Dim response As FormPanelResult = New FormPanelResult
            Dim sUserName As String = HttpContext.User.Identity.Name
            Dim sUserID = (From u In DBSecurityContext.aspnet_Users Where u.UserName = Trim(sUserName) Select u.UserId).First
            Dim sSRID = (From p In DBSecurityContext.UserProfiles Where p.UserId = sUserID Select p.SRID).First
            ViewData("SRID") = sSRID
            ViewData("UserName") = sUserName.ToLower
    
            Try
                Dim instmp As New tbl_EmailTemplate With _
                    {.TemplateName = "Test1", _
                     .TemplateOwner = sUserName, _
                     .TemplateText = text, _
                     .DateCreated = DateTime.Now}
    
                DBIEnergyContext.tbl_EmailTemplates.InsertOnSubmit(instmp)
                DBIEnergyContext.SubmitChanges()
    
                response.Success = True
                response.ExtraParams("msg") = "Template has been uploaded."
    
            Catch ex As System.Exception
                response.Success = False
                response.ExtraParams("msg") = "Error: " & "..." & ex.Message
    
            End Try
    
            Return response
        End Function
    The issues are thusly:

    1. When i use #{eEmail}.getValue(), the method call is never run and nothing happens at all.
    2. When i use #{eEmail}.text, the method is called, however NULL is what is passed back into the method.
    3. When i use #{eEmail}.value, a value is passed back but it is formatted strangely, also when i submit the same values twice, 2 different values are stored in the database. Here's a screenshot of the editor, and the values being stored in the db:

    Click image for larger version. 

Name:	test.jpg 
Views:	2 
Size:	78.3 KB 
ID:	24081

    submitting this same content twice yields the following in the db:
    "%3Cb%3ETest%3C/b%3E%3Cbr%3E%3Ci%3ETest%" etcetera etcetera
    and
    "%253Cb%253ETest%253C/b%253E%253Cbr%253E%" etcetera etcetera

    If this is the correct values of the html, then how can i convert this value BACK into the htmlEditor so that is displays the same way it was entered?
  2. #2
    Hi @navalurzu7,

    Welcome to the Ext.NET forums!

    1. When i use #{eEmail}.getValue() ...
    I think .getValue() is a correct way to go.

    the method call is never run and nothing happens at all.
    Is there any JavaScript error in a browser's console?

    Please try to change #{eEmail}.getValue() to App.eEmail.getValue().

Similar Threads

  1. [CLOSED] HtmlEditor as a editor issue
    By hdsoso in forum 2.x Premium Help
    Replies: 5
    Last Post: Jun 09, 2014, 11:17 AM
  2. Replies: 6
    Last Post: Mar 07, 2014, 5:51 PM
  3. [CLOSED] HtmlEditor Issue in IE 9
    By logicspeak in forum 1.x Premium Help
    Replies: 2
    Last Post: Sep 15, 2011, 9:38 PM
  4. [CLOSED] HTMLEditor Issue after last Update
    By amitpareek in forum 1.x Premium Help
    Replies: 1
    Last Post: May 27, 2010, 3:05 PM
  5. HtmlEditor Issue
    By DasPhansom in forum 1.x Help
    Replies: 2
    Last Post: Sep 28, 2009, 12:57 PM

Tags for this Thread

Posting Permissions