2 Replies Latest reply on Aug 24, 2011 5:36 PM by Aldo Bonzi

    How to not refres the page

    Piotr Salski Newbie

      I have an issue. I have 2 forms on the page and one is not visible

      <h:form id="selres">
      <h:commandButton  value="Rezerwuj" actionListener="#{reservation.getPatient}" action="#{reservation.rezerwuj()}" onclick="javascript:hide();" >
      <h:form id="confRes" style="display: none">

      and javascript
      function hide(){
           var conf = document.getElementById("confRes");
           var res = document.getElementById("selres");
           if (conf.style.display=="none"){

      the problem is that commandButton makes submit and refreshes the page after javascript will show confRes form so it will be hidden again.

      What should I do to:

      - submit the action

      - hide selres form

      - show confRes form