开发者

JSF/Richfaces/A4j ==> component/field conversion and reRendering problem

I have an input field in a JSF Page like the following (maps to BigDecimal on backing bean)

    <h:inputText disabled="#{volumeBean.grossVolumeDisabled}" id="grossVolume" size="10" validateOnExit="true" value="#{volumeBean.enteredGrossVolume}" >
    <a4j:support ajaxSingle="true" event="onblur" ignoreDupResponses="true" oncomplete="checkFieldValidation(this)" onsubmit="updateDirty()"/>
    </h:inputText>

And an a4j:commandButton to "refresh" all the data from the database on the page:

    <a4j:commandButton accesskey="T" action="#{volumeBean.revert}" button-type="ajax" disabled="#{volumeBean.revertDisabled}" id="volumeBean_reset"         immediate="true" reRender="volumesTable" value="#{msg.button_RESET}"/>

Here are the steps to reproduce my problem: And please note that the error occurs regardless of whether there is a reRender attribute set on the a4j:support

Here are the steps to reproduce - just to clarify further:

  1. navigate to the screen where the BigDecimal input field exists
  2. type aa into the field (should be a number but put non-numeric characters purposely)
  3. tab off the field
  4. notice that an error is reported 'aa' is not a valid netVolume
  5. click on the RESET button
  6. all of the changed fields have their original values EXCEPT those that have non-numeric data entered
  7. unless the user manually deletes the non-numeric data in the fields or refreshes开发者_StackOverflow the entire screen, the "bad data" sticks


When you do a reset, you fire an Ajax request, the entire form is submitted and you get validation error again. So the field still has the old (incorrect) value.


Try adding the parameter ajaxSingle="true" to the button. I've found that immediate="true" is not adequate for bypassing validation on ajax components.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜