3 Replies Latest reply on Jun 13, 2008 8:35 AM by Stan Silvert

    JSFClientSession.submit not working with h:commandButton

    Justin G Newbie

      I'm using JSFUnit Beta 2 and am having problems getting JSFClientSession.submit to work properly with h:commandButton. I should note that we're also using RichFaces 3.2.X and Facelets. I have a simple test that clicks a button in the footer of a rich:dataTable (not sure if that part matters) like so:

      <h:commandButton id="myButton"
       onclick="if (!confirm('Are you sure?')) return false;"

      The action performs some logic and returns the navigation case for the next page. If I use JSFClientSession.submit("myButton") in the test code, the button is pressed but the action code is never executed. The strange part is that it appears the page navigated correctly via JSFServerSession.getCurrentViewId(). (must be just luck)

      However, it all works correctly if I use RichFacesClient.ajaxSubmit("myButton"). I don't understand why. Does the javascript have anything to do with it? The only other thing I can think of is that the test performs other ajaxSubmits before clicking myButton that might interfere?