1 Reply Latest reply on Apr 25, 2014 9:50 AM by michpetrov

    Value of rich:select which is not in selectItems

    1scrapper1

      Hello

      I'm migrationg the project to Ricfaces 4.3.5.Final

      I have the following situation. There is a list of contract terms, where possible contract durations are stored. This list is changed over time. At the same time historical contracts are already made for duration which is not available anymore.

      In the end I have the following:

      <rich:select id="term" value="#{contractBean.contract.term}" #{contratBean.contract.historical}  
                  converter="#{termConverter}" required="true">
          <f:selectItems value="#{contractBean.validTerms}"/>
          <a4j:ajax event="selectitem" execute="@this" limitRender="true" render="backbone" />
      </rich:select>
      

       

       

      where #{contractBean.contract.term} is "7 Days" and invalid anymore.

       

      and #{contractBean.validTerms} returns only "1 Month", "1 Quarter" "1 Year".

       

      As a result - since new Richfaces validate that value should always be present in selectItems - "7 days" is not displayed. And since component is disabled - value cannot be changed. Obviously, any submit of the page causes (opening any popup vith contract details for instance) "Field term is required" error.

       

      I can add current term value to selectItems, but first of all it's a hack and secondly we have hundreds of places like that. so I'm seeking for a less time-consuming option.

       

      So is there any other workaround to solve this situation?

        • 1. Re: Value of rich:select which is not in selectItems
          michpetrov

          Hi,

           

          why not put the value inside a simple textbox since the user cannot change it anyway? (Or if you only disable it for the historical data, show textbox for those.)

           

          What version are you migrating from? I wouldn't think the select worked the way you described, it's against specification.