3 Replies Latest reply on Jan 6, 2011 11:39 PM by Murali Krishna

    Problem with rich:ajaxValidator inside rich:modalPanel

    Artem K. Newbie

      Hello everybody,


      I have a weird problem when using rich:ajaxValidator component. Here is the setup:

      - A page contains an output text bound to an action bean value, along with the "Edit" button

      - When edit button is pressed, rich:modalPanel appears with an input to edit this value. The input is validated with rich:ajaxValidator in onblur event.

      - The modal panel has two aj4:commandButtons, "Update" and "Cancel". Cancel closes the modal panel without applying values, Update submits the form, reRenders the output text behind modal panel and closes the modal panel.


      The problem I experience is when I open the modal panel, make modifications in the input and allow them to be validated by rich:ajaxValidator but then press Cancel. When I reopen the modal panel, instead of having the value in the action bean, I have the value that I previously entered. This happens because when rich:ajaxValidator was invoked, apply request values phase was executed and input component value was updated with what I entered prior to cancelling the modal panel. So now, even when I reRender the whole modal panel when "Edit" button is pressed, the input uses the value stored in the component, instead of using action bean value even though update model values phase was never executed.


      I'm not sure if this is an expected behaviour for rich:ajaxValidator. It seems to me that rich:ajaxValidator should rollback the value change in the component independently of whether validation fails or not. However, if it is the expected behaviour, is there any walkaround for this issue for my particular case?


      Thank you