我有两个日期字段(从/到),它们呈现整个createPanel(id =“ createPanel”),例如,根据日期范围,(每月,每天,每周,无)的ratiobuttons(id =“ wiederholungsSelect”) 。如果更改了“从”或“到”日期,则应该更新一个比率按钮。 并且,如果所有内容均已填写完毕,则用户单击命令按钮将其保存。
那在实践中会发生什么?
用户键入起始日期(id =“ gueltigAb”)和终止日期(id =“ gueltigBis”),然后直接单击命令按钮(id =“ newSave”)。但是单击仅触发ajax的onchange事件,而不触发按钮。现在,用户必须单击按钮,这非常麻烦。
已测试了什么?
尽管我测试过:
<f:ajax event="change" execute="@this" render="form:createPanel" />
<f:ajax event="valueChange" execute="@this" render="form:createPanel" />
<f:ajax event="blur" execute="@this" render="form:createPanel" />
<f:ajax event="change" execute="form:createPanel" render="form:createPanel" />
是否可以触发onchange和单击的按钮?
<h:panelGroup id="createPanel" layout="block">
<!-- Links Spalte -->
<h:selectOneMenu id="grund"
items="#{mybean.grundItems}"
value="#{mybean.unterbrechungsgrund}">
<rich:ajax event="change" execute="@this" render="form:createPanel" />
<rich:calendar id="gueltigAb"
value="#{myBean.gueltigAb}">
<rich:ajax event="change" execute="@this" render="form:createPanel"/>
</rich:calendar>
<rich:calendar id="gueltigBis"
label="#{ui['fallverwaltung.pflegefall.unterbrechungen.erfassen.bis']}"
value="#{myBean.unterbrechungBis}">
<rich:ajax event="change" execute="@this" render="form:createPanel"/>
</rich:calendar>
<o:importConstants type="...LocalDateUtils.TerminWiederholung"/>
<h:selectOneRadio id="wiederholungsSelect" label="#{ui['wiederholung.label']}"
layout="pageDirection" value="#{myBean.terminWiederholung}">
<f:selectItem itemValue = "#{TerminWiederholung.KEINE_WIEDERHOLUNG}"
itemLabel="#{ui['wiederholung.keineWiederholung']}" />
<f:selectItem itemValue = "#{TerminWiederholung.WOECHENTLICH}"
itemLabel="#{ui['wiederholung.woechentlich']}"
itemDisabled="#{not myBean.woechentlichMoeglich()}" />
<f:selectItem itemValue = "#{TerminWiederholung.MONATLICH}"
itemLabel="#{ui['.wiederholung.monatlich']}"
itemDisabled="#{not myBean.monatlichMoeglich()}" />
<rich:ajax event="change" execute="@this" render="form:createPanel" />
</h:selectOneRadio>
<rich:calendar id="endDatum"
label="#{ui['wiederholung.enddatum']}"
value="#{myBean.terminEnddatum}">
<rich:ajax event="change" execute="@this" render="form:createPanel" "/>
</rich:calendar>
<h:inputTextarea rows="6"
maxlength="200" showRemainingCharacters="true"
value="#{myBean.notiz}">
</h:inputTextarea>
</h:panelGroup>
<h:commandButton id="abortBtn"
value="#{ui['aktion.abort']}">
<f:ajax
listener="#{myBean.abort()}"
execute="@this" render="@form" />
</h:commandButton>
<!-- Save Button -->
<h:commandButton id="newSave" role="submit"
value="#{ui['aktion.save']}">
<f:ajax
listener="#{myBean.save()}"
execute="@form" render="@form" />
</h:commandButton>