2 Replies Latest reply on Jul 1, 2011 6:03 AM by Julia López

    UIInputContainer id and label

    Julia López Newbie

      Hi!


      I've created a custom component using the UIInputContainer (copy/paste the example) and I've seen some weird behaviour.
      The thing is that if I specify and id and a label attributes in my component, the label is ignored and the id is used. I've checked the code and the next part seems okey.



      if (!getAttributes().containsKey(getLabelAttributeName())) {
          getAttributes().put(getLabelAttributeName(), generateLabel(elements, context));
      }





      Doing a further debug I saw that the if condition is always true, so the containsKey is always false even so you put the label attribute. The weird thing is that if you do the next call



      getAttributes().get(getLabelAttributeName());




      you get the label value!! but the containsKey returns false!! How is this even possible?!?! XD


      I'm using Mojarra and I suppose the problem is theirs. Maybe the if condition should be



      getAttributes().containsKey(getLabelAttributeName()) == null




      to make it work as expected


      Regards!

        • 1. Re: UIInputContainer id and label
          Julia López Newbie

          OMG, I think I found the problem


          My code is something like:


          <my:inputContainer label="#{messages['whatever']}" id="whateverId">
             ...
          </my:inputContainer>



          But if I don't use i18n for the ,it works! with the containsKey condition!


          I'm going to find if there's an issue about this...


          Regards!

          • 2. Re: UIInputContainer id and label
            Julia López Newbie

            Copy and paste mistake! When I said:




            I'm using Mojarra and I suppose the problem is theirs. Maybe the if condition should be

            getAttributes().containsKey(getLabelAttributeName()) == null



            to make it work as expected



            I meant


            getAttributes().get(getLabelAttributeName()) == null



            Sorry! ;)


            PD: Why not an edit action for forum post? hehehe