2 Replies Latest reply on Oct 13, 2011 5:00 PM by sensationalist

    After change event.

    sensationalist

      Hi.

      We can do somenthing in backing bean by ajax after some event. For example I can use "change" event in select or in calendar.

       

       

      But it executes changeDate method before the form values are filled to back bean fields.Is there some event like "afterchange" or something else alowing to process the values at back bean?

        • 1. Re: After change event.
          h2g2

          Hi,

           

          the valueChangeEvent is fired before the UPDATE_MODEL_VALUES phase in which backing bean values are filled with the form ones.

          Some convenient to make it work the way you expect would be to catch , postpone  and repost the event it so that it will be managed in a later phase.

           

          Do it that way :

           

          public final void fileUploadListener(final UploadEvent event) throws Exception {
                  final PhaseId phaseId = event.getPhaseId();
                  if (phaseId.equals(PhaseId.ANY_PHASE)) {
                      // In order to retrieve data updated from the model
                      // we postpone the management of the file upload event
                      event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
                      event.queue();
                  } else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES)) {
                      doMyStuffs();
                  }
          }
          

          Hope this will help.

          • 2. Re: After change event.
            sensationalist

            Thanks a lot! It works