lyon_fanfan
2009-08-17 17:42
浏览 249
已采纳

fckeditor 页面不能提交

出错现象:当运行到success:function(form,action) 就直接跳到failure里面去了 根本就没有过服务器 但是我把fckeditor去掉后 可以提交到服务器的 请问大家为什么

代码:
[code="java"]
//用于智能提示显示
///
/*
*发表新贴
*/
//document.write("&lt;\/script&gt;&quot;)<br> function NewArticle()/// <br> {<br> var NewArticleTitle = new Ext.form.TextField({<br> id:&#39;NewArticleTitle&#39;<br> ,fieldLabel:&#39;<span style="color:red"> 标 题</span>&#39;<br> ,allowBlank : false<br> ,emptyText : &#39;请填写 标题&#39;<br> ,text:&quot;请输入 标题&quot;<br> ,anchor:&#39;90%&#39;<br> });</p> <pre><code>var NewArticleCategoryStore = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({url:&#39;json/HomePage/Modul.aspx?Param=listForCombox&amp;CategoryId=10000&#39;,method:&#39;get&#39;}) ,reader:new Ext.data.JsonReader({}, [{name:&#39;CategoryID&#39;} ,{name:&#39;ModualID&#39;} ,{name:&#39;IsLeaf&#39;} ,{name:&#39;ModualIndex&#39;} ,{name:&#39;ModulName&#39;} ,{name:&#39;ParentModalID&#39;} ]) }) //NewArticleCategoryStore.load(); var NewArticleModule = new Ext.form.ComboBox({ id:&#39;NewArticleModule&#39; ,fieldLabel:&#39;&lt;span style=&quot;color:red&quot;&gt; 栏 目&lt;/span&gt;&#39; ,allowBlank : false ,emptyText : &#39;请选择 栏目&#39; ,text:&quot;请选择 栏目&quot; ,anchor:&#39;90%&#39; ,resizable : true //,minListWidth : 220 //,pageSize:5 ,editable:false ,autoLoad:true ,mode: &#39;remote&#39; ,store:NewArticleCategoryStore ,displayField:&#39;ModulName&#39; ,valueField:&#39;ModualID&#39; ,hiddenName : &#39;ModualID&#39; ,triggerAction: &#39;all&#39; ,selectOnFocus:true }); var NewArticleContent = new Ext.form.TextArea({ id:&#39;NewArticleContent&#39; ,fieldLabel:&#39;&lt;span style=&quot;color:red&quot;&gt; 内 容&lt;/span&gt;&#39; ,allowBlank : false ,anchor:&#39;90%&#39; ,height:340 ,allowBlank : false ,emptyText : &#39;请输入 内容&#39; }); var NewArticleCancleButton = new Ext.Button({ text:&#39;取 消&#39; ,tooltip:&#39;取 消&#39; ,listeners:{ &#39;click&#39;:function(th,e){ var CenterTable = Ext.getCmp(&#39;id_Tab_Center&#39;); var temp_NewArticlePanel = Ext.getCmp(&#39;GirdViewPanel&#39;); if (temp_NewArticlePanel) { CenterTable.remove(temp_NewArticlePanel,true); } } } }); var NewArticleOKButton = new Ext.Button({ text:&#39;提 交&#39; ,tooltip:&#39;提 交&#39; ,listeners:{ &#39;click&#39; : function(){ fckobj_temp = FCKeditorAPI.GetInstance(&#39;NewArticleContent&#39;); Ext.get(&#39;NewArticleContent&#39;).dom.value = fckobj_temp.GetXHTML(true); var temp_UserName = getCookie(&#39;www.ForU.com_LoginNameCookie&#39;); var Temp_ModuleName = NewArticleModule.getRawValue(); var Temp_ModuleId = NewArticleModule.getValue(); var Temp_ArticleName = Ext.getCmp(&#39;NewArticleTitle&#39;).getValue(); var Temp_Content = Ext.getCmp(&#39;NewArticleContent&#39;).getValue(); alert(Temp_Content); //提交 if (NewArticleFormPanel.getForm().isValid()) { NewArticleFormPanel.getForm().doAction(&#39;submit&#39;,{ url:&#39;json/Forum/NewArticle.aspx&#39; ,method:&#39;POST&#39; ,params:{FunctionName:&#39;NewArticle&#39;,UserName:temp_UserName,NewArticleTitle:Temp_ArticleName,NewArticleModule:Temp_ModuleId} ,waitMsg:&#39;提交中,请等待....&#39; ,success:function(form,action){ Ext.Msg.alert(&#39;提示&#39;,&#39;发帖成功!&#39;); } ,failure:function(form,action){ Ext.Msg.alert(&#39;提示&#39;,&#39;网络中断造成连接失败!&#39;); } }) } } } }); var NewArticleResetButton = new Ext.Button({ text:&#39;重 置&#39; ,listeners:{ &#39;click&#39; : function(){ Ext.getCmp(&#39;NewArticleTitle&#39;).setValue(&#39;&#39;); Ext.getCmp(&#39;NewArticleContent&#39;).setValue(&#39;&#39;); } } }); var NewArticleFormPanel = new Ext.form.FormPanel({ title : &#39;发表新贴&#39; ,id : &#39;NewArticleFormPanel&#39; ,frame:true ,autoWidth:true ,autoheight:true ,autoScroll:true ,closable:true ,layout:&#39;form&#39; ,collapsible:true ,items:[NewArticleTitle,NewArticleModule,NewArticleContent] ,buttons:[NewArticleCancleButton,NewArticleOKButton,NewArticleResetButton] }) </code></pre> <p>//-----------------------------------------------------<br> var CenterTable = Ext.getCmp(&#39;id_Tab_Center&#39;);<br> if (CenterTable)<br> {<br> for (var i=0;i&lt;CenterTable.items.length;i++)<br> {<br> if (CenterTable.items.items[i].title == &#39;发表新贴&#39;)<br> {<br> CenterTable.activate(CenterTable.items.items[i]);<br> return;<br> }<br> }<br> CenterTable.add(NewArticleFormPanel);<br> CenterTable.activate(NewArticleFormPanel);<br> }<br> var Temp_Height = Ext.getCmp(&#39;NewArticleContent&#39;).getSize().height;<br> var Temp_Width = Ext.getCmp(&#39;NewArticleContent&#39;).getSize().width;<br> var fckobj = new FCKeditor(&#39;NewArticleContent&#39;,Temp_Width,Temp_Height);<br> fckobj.BasePath = &quot;FCKeditor/&quot; ;<br><br> fckobj.ToolbarSet = &#39;Default&#39; ;<br><br> fckobj.ReplaceTextarea();</p> <pre><code>NewArticleTitle.on(&#39;resize&#39;,function(th,aw,ah,rw,rh){ fckobj.Height = 150; fckobj.Width = aw; }); </code></pre> <p>//-------------------------------------------------------<br> }</p> <p>[/code]<br> [b]问题补充:[/b]<br> 谢谢 两位。<br> form提交后 会自动把form上的控件内容传入服务器 所以应该这么写:<br> Ext.get(&#39;NewArticleContent&#39;).dom.value = encodeURIComponent(fckobj_temp.GetXHTML(true));</p>

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • iteye_3681 2009-08-17 18:36
    已采纳

    肯能是提交的FCK中存在HTML标记导致提交失败.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • iteye_10013 2009-08-17 18:04

    doAction里面报错了吧.
    估计是特殊字符什么的处理不好.
    源码跟踪下吧

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题