Jul 14, 2015, 4:05 PM
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:
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:
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?
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:
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?