Ckeditor rich:popupPanel在.hide()上提交值,这是我不想要的

Ckeditor rich:popupPanel在.hide()上提交值,这是我不想要的,ckeditor,richfaces,submit,Ckeditor,Richfaces,Submit,我在取消RichFaces4中使用CKeditor所做的更改时遇到问题 简言之: <form> ... <rich:popupPanel> <rich:editor id="#{popupID}" value="#{managedBean.value}" /> <a4j:commandButton value="Annuleer" onclick="#{rich:component(popupID)}.hide();" /&g

我在取消RichFaces4中使用CKeditor所做的更改时遇到问题

简言之:

<form>
  ...
  <rich:popupPanel>
     <rich:editor id="#{popupID}" value="#{managedBean.value}" />
     <a4j:commandButton value="Annuleer" onclick="#{rich:component(popupID)}.hide();" />
     <a4j:commandButton value="Ok" onclick="saveEditorData();" />
  </rich:popupPanel>
  ...
</form>

...
...
当我按下[Cancel](“环化器”)按钮时,它关闭popuppanel并将值“提交”给bean。按[取消]时,我不希望它提交值。我有一种感觉,我错过了一些非常简单但却至关重要的东西,使这项工作得以开展

如何使[取消]按钮按预期工作

完整代码:

<rich:popupPanel
 id="#{popupID}"
 modal="true"
 autosized="true"
 resizeable="false"
 styleClass="popup-panel"
 style="z-index:202;"
 left="300"
 domElementAttachment="parent">
 <f:facet name="header">
    <h:outputText value="Text Editor " />
 </f:facet>
 <f:facet name="controls">
    <a4j:commandButton
    value="X"
    type="reset"
    id="popupAfsluiten"
    render="#{panelID}"
    styleClass="btn-afsl"
    onclick="showLoadingOverlay();#{rich:component(popupID)}.hide();"
    oncomplete="cleanOverlay();setFocus('#{rich:clientId(inputID)}');return false;"/>
 </f:facet>
 <rich:panel id="#{cc.attrs.id}TextPanel">
     <rich:editor id="textEditor" lang="nl" value="#{cc.attrs.managedBean.formField(cc.attrs.id).value}" toolbar="CustomToolbar">
        <f:facet name="config">
            toolbar_CustomToolbar:
                [
                    { name: 'document', items: [ 'Save', 'NewPage', 'Preview', 'Print'] },
                    { name: 'clipboard', items : [ 'Cut','Copy','PasteText','-','Undo','Redo' ] },
                    { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
                    { name: 'tools', items : [ 'Maximize' ] }
                ],
            language: 'nl',
            defaultLanguage : 'nl',
            scayt_sLang : 'nl_NL',
            startupFocus: true,
            pasteFromWordPromptCleanup : true,
            pasteFromWordRemoveFontStyles : true,
            forcePasteAsPlainText : true,
            ignoreEmptyParagraph : true,
            removeFormatAttributes : true,
            removePlugins : 'elementspath',
            tabSpaces : 4,
            autoParagraph : false,
            autoUpdateElement : false,
            enterMode: Number(2)
        </f:facet>
    </rich:editor>
    <a4j:commandButton
    value="Annuleer"
    type="reset"
    id="editorCancel"
    render="#{panelID}"
    styleClass="btn-ja"
    onclick="showLoadingOverlay();#{rich:component(popupID)}.hide();"
    oncomplete="cleanOverlay();setFocus('#{rich:clientId(inputID)}');return false;"/>

    <a4j:commandButton
        value="Ok"
        type="submit"
        styleClass="btn-ja"
        id="#{inputID}Save"
        render="#{inputID}"
        onclick="saveEditorData();"
        oncomplete="setTime();" />
        <h:outputText escape="false" value="Opgeslagen om: " />
        <h:outputText escape="false" value="#{editorBean.value}" id="saveTimeOutput"/>
     </rich:panel>
  </rich:popupPanel>

工具栏\自定义工具栏:
[
{name:'document',项:['Save','NewPage','Preview','Print']},
{name:'clipboard',项:['Cut','Copy','PasteText','-','Undo','Redo']},
{name:'editing',项:['Find'、'Replace'、'-'、'SelectAll'、'-'、'Scayt']},
{name:'tools',items:['Maximize']}
],
语言:“nl”,
defaultLanguage:'nl',
斯盖特(scayt_)俚语:“nl_nl”,
startupFocus:没错,
pasteFromWordPromptCleanup:true,
pasteFromWordRemoveFontStyles:true,
forcePasteAsPlainText:对,
ignoreEmptyParagraph:对,
removeFormatAttributes:true,
removePlugins:'elementspath',
选项卡空间:4,
自动参数:错误,
autoUpdateElement:false,
进入模式:编号(2)

这不是popupPanel做的<默认情况下,code>和
commandLink
提交整个表单。如果您不想提交任何内容,请添加
execute=“@none”

不是popupPanel做的<默认情况下,code>和
commandLink
提交整个表单。如果您不想提交任何内容,请添加
execute=“@none”

表单由a4j:commandButton提交

如果您使用的是richfaces 3.3.3,那么像这样添加属性ajaxSingle=true

<a4j:commandButton value="Annuleer" ajaxSingle="true"  
                     onclick="#{rich:component(popupID)}.hide();" />  

如果您使用的是richfaces 4.X,则使用execute属性

 <a4j:commandButton value="Annuleer" execute="@this"  
                   onclick="#    {rich:component(popupID)}.hide();" />  

在这两种情况下,后端只处理命令按钮


希望这能有所帮助。

该表单由a4j:commandButton提交

如果您使用的是richfaces 3.3.3,那么像这样添加属性ajaxSingle=true

<a4j:commandButton value="Annuleer" ajaxSingle="true"  
                     onclick="#{rich:component(popupID)}.hide();" />  

如果您使用的是richfaces 4.X,则使用execute属性

 <a4j:commandButton value="Annuleer" execute="@this"  
                   onclick="#    {rich:component(popupID)}.hide();" />  

在这两种情况下,后端只处理命令按钮


希望这有帮助。

要完全取消对服务器的请求,请添加
return false到onclick处理程序:

<a4j:commandButton value="Annuleer"
        onclick="#{rich:component(popupID)}.hide(); return false" />


如果仍然需要重新渲染某些区域(因此需要ajax请求),则使用其他答案中说明的解决方案(
execute=“@this”
)。

要完全取消对服务器的请求,请添加
return false到onclick处理程序:

<a4j:commandButton value="Annuleer"
        onclick="#{rich:component(popupID)}.hide(); return false" />


如果仍然需要重新渲染某些区域(因此需要ajax请求),请使用其他答案中所述的解决方案(
execute=“@this”
)。

我认为应该是execute=“@this”。“@none”将不处理任何内容执行=“@none”和执行=“@this”工作。这两个之间有什么区别吗?@SrikanthGanji但没有什么需要处理的。该按钮没有需要执行的
@actionListener
。我认为应该是execute=“@this”。“@none”将不处理任何内容执行=“@none”和执行=“@this”工作。这两个之间有什么区别吗?@SrikanthGanji但没有什么需要处理的。该按钮没有需要执行的
@actionListener