0 Replies Latest reply on Dec 5, 2007 5:39 PM by Jose de Castro

    Scope change in oncompete handler for a4j:commandButton?

    Jose de Castro Newbie

      Did the scope in which the oncompete handler is executed change in 3.1?

      The behavior for the following component declaration changed in RichFaces 3.1 but I can't figure out why. I have been using this (validate, disabled, call, enable) pattern in 3.0.1 for while and would like to move to 3.1 to make use of Seam 2.0.

      Expected result:

      * User clicks on 'Open' button
      * Form is validated
      * Locally-scoped cmdRef variable is used to hold a reference to button
      * projectManager.open is called
      * Button is re-enabled
      * Client-side open hander is invoked


      <a4j:commandButton id="cmdOpen" value="Open"
       onclick="if(projectGrid.validate()){var cmdRef=this; this.disabled=true;}else{return false;}"
       actionListener="#{projectManager.open}"
       oncomplete="cmdRef.disabled=false; dialog.handleOpen('SAVE');"
      />


      As I said, this was working fine in 3.0.1. However, once I upgraded to 3.1, processing of oncomplete seems to stop when it reaches cmdRef.disabled. I have confirmed that oncomplete is being called by adding an alert before it. I can also switch the order of my statements and have handleOpen called but the button is never re-enabled.

      Any help would be greatly appreciated. I don't mind changing my approach if mine is no longer possible in the new model.

      Thank in advance,

      Jose de Castro
      Sr. Software Engineer
      Voxeo Corporation