0 Replies Latest reply on Jun 13, 2012 2:09 PM by Rathi Rajaram

    How to avoid Cancel button doing validation

    Rathi Rajaram Newbie

      Hi All,

       

           I have one question in JSF pag,I have some input controls,save and cancel in my screen.For all myinput contols i am doing a mandatory validation,this validation shd be done upon saving the form ,but when i click on cancel also its doing the validation.

       

      <h:form>

      <h:inputText id="age" value="#{bean.age}" required="true" requiredMessage="Age is required">

      </h:inputText>

      <h:inputText id="name value="#{bean.name}" required="true" requiredMessage="Name is required">

      </h:inputText>

      <a4j:commandButton action="#{bean.save}" value="save"/>

      <a4j:commandButton action="#{bean.cancel}" value="cancel"/>

      </h:form>

       

      when i click on the save it shd do the validation,but its doing the validation on cancel btn also,how to avoid cancel btn not to validate?

       

       

      Any ideas ,will be helpful.

       

      Thanks in advance.