0 Replies Latest reply on Dec 2, 2008 11:28 AM by Sanne Grinovero

    wrong selected in selectOneMenu for portal-identity

    Sanne Grinovero Master

      I've been following the reference guide to add new internationalized properties to identity-ui-configuration.xml:

      <ui-component name="typeofcustomer">
       <property-ref>portal.user.typeofcustomer</property-ref>
       <values>
       <value key="xi">individual</value>
       <value key="xc">company</value>
       </values>
       <required>true</required>
      </ui-component>

      and in the view:

      <h:selectOneMenu id="typeofcustomer" value="#{manager.uiUser.attribute.typeofcustomer}" required="#{metadataservice.typeofcustomer.required}">
       <f:selectItems value="#{metadataservice.typeofcustomer.values}" />
      </h:selectOneMenu>
      <h:outputText value="DEBUG: #{manager.uiUser.attribute.typeofcustomer}"/>

      Internazionalized:
      IDENTITY_DYNAMIC_VALUE_XI=Individual
      IDENTITY_DYNAMIC_VALUE_XC=Company


      This code works correctly the first time, and correctly updates the values, but when using the page to update the information for an existing user it always shows the first option of the generated .
      Using the DEBUG line you see in the view code I've discovered that the value it's showing is not the option key, but the localized value:
      It prints "Company" when the correct value is Company (bundle key=XC), but the selectOne menu is showing "Individual" because it's the first in the list.

      This behaviour is nice of course for when I have to "show" the value only using the outputText, but breaks all selectOnes!
      My current workaround is to not localize this value, and use key==shown value.