2 Replies Latest reply on Nov 17, 2009 7:59 AM by Zdeněk Zikán

    Having two fields of which only one should be used at a time

    Zdeněk Zikán Newbie

      I am RichFaces newbie and I'm trying to achieve following:

      I have Entity which is of some EntityType.
      User can either
      - enter entity ID into edit box and it will show him table with this single entity
      - select entity type from drop down menu - then it will show him the same table, just with multiple entities of that type.

      I JSP it looks like this:

      <h:form id="searchForm">
       Select single entity ID:
       <h:outputLabel for="entityId">ID number</h:outputLabel>
       <h:inputText id="entityId" value="#{dataUpdateBean.entityId}"/>
       <h:commandButton value="Search" type="submit" />
       or select a category
       <h:selectOneMenu value="#{dataUpdateBean.selectedTypeId}">
       <f:selectItems value="#{dataUpdateBean.selectItems}" />
       <a4j:support event="onchange" reRender="searchForm" />

      However, I need a way how to distinguish whether user entered entityId (in that case, I will also change selectedTypeId to reflect it) or whether he selected some type, so I should use only selectedTypeId and null entityId's value.

      Anyone would help me?
      Thanks, Zdenek