我有以下代码:
...
<h:inputText
id="valorMoedaLocal"
value="#{pagamentoRegistrarMB.valorMoedaLocal}"
styleClass="right dinheiro"
size="12"
maxlength="12">
<f:convertNumber
type="number"
minFractionDigits="2"
maxFractionDigits="2" />
<a4j:ajax
event="change"
execute="valorMoedaLocal"
render="valorPagamento"
listener="#{pagamentoRegistrarMB.calculaValorRealOuroCorrecao}" />
</h:inputText>
<h:outputText
id="valorPagamento"
value="#{pagamentoRegistrarMB.valorPagamento}"
maxlength="12">
<f:convertNumber
type="number"
minFractionDigits="2"
maxFractionDigits="2" />
</h:outputText>
...
<h:commandButton
id="cbCorrigir"
value="#{messages['label.corrigir.pagto']}"
action="#{pagamentoRegistrarMB.validarCorrecao}"
disabled="#{empty pagamentoRegistrarMB.idRequerimentoMovimentoCorrigir}">
<f:param
name="id"
value="#{pagamentoRegistrarMB.bean.id}" />
</h:commandButton>
如果我更改字段valorMoedaLocal的内容然后单击按钮cbCorrigir,则执行嵌套在inputText上的ajax,并且不执行来自按钮cbCorrigir的操作;它需要再次点击才能执行。
发生这种情况是因为当我点击按钮时,inputText会失去焦点并暂停其执行的ajax,从而阻止后续执行。有没有办法避免这种不良行为?