3 Replies Latest reply on Oct 15, 2008 4:00 AM by Val Sw

    How to bypass required = true validation message on a link click.

    Val Sw Expert
      Please suggest on how to by-pass required="true" validation on particular link click...

      Situation :
      I have a form field whose value is required.

      when user clicks "Save", h:inputText is validated if it is null i.e. gives proper message as "value is required".

      However, I have a functionality to remove "h:inputText" filed. When I click "Remove" and value in "h:inputText" is null it still validates i.e. gives message "value is required".
      How can I bypass validation on clicking "Remove" link.

      xhtml:
      ------
      <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
      <h:form id="study" styleClass="edit">
      <td align="center" class="dr-subtable-cell rich-subtable-cell" height="20%">
          <h:commandLink action="#{studyHome.removeReagent}" value="Remove" immediate="true"/>                                 
      </td>

      <td align="center" class="dr-subtable-cell rich-subtable-cell" height="20%">
           <s:decorate template="layout/edit.xhtml">
                <h:inputText id="pname1" required="true" value="#{info.pname}"/>
           </s:decorate>
      </td>

      <h:commandButton id="save" value="Save" action="#{studyHome.persist}"
           disabled="#{!studyHome.wired}" rendered="#{!studyHome.managed}"/>
      </h:form>