extjshtmleditor 提交出错 解决

    技术2025-08-21  12

    htmleditor 是extjs中自带的一个简单编辑器,

    { id:'home', title:'通知', layout: 'form', labelAlign: 'top', items: [{ xtype: 'htmleditor', fieldLabel: '通知', id:'editor', anchor: '98%' }

     

    value是用来加载内容的。

     

    提交

    buttons:[{ text: '保存', handler:function () { var edit_value=Ext.util.Format.htmlEncode(Ext.getCmp('editor').getValue()); form.getForm().submit({ url:'save.aspx', waitMsg:'正在保存........', params:{editor1:edit_value}, success:function (f,action) { Ext.Msg.alert('提示', action.result.msg); }, failure: function() { Ext.Msg.alert('错误', "添加失败"); } }) } }]

    需要转码

    htmlDecode   (  String value   ) : String

    将(&, <, >, and ')字符从HTML显示的格式还原 参数项: value   : String 解码的字符串 返回: String   编码后的文本 加载时需要使用Ext.util.Format.htmlDecode 这样内容保存在数据库中就不会报错了

    最新回复(0)