2 Replies Latest reply on Feb 17, 2008 12:09 AM by Robert Stevens

    How do I populate menu with a variable amount of list data?

    Robert Stevens Newbie

      I want to populate several selectOneMenu tags (select boxes) with a variable number of strings.


      For example, a selectOneMenu may have five items in English and seven in Spanish.


      My goal is to make it easy for language translators so they can do their job without expensive programmer intervention.


      If I use name-value pairs in language bundles my code would have to hard code the name of every menu item, so that solution wouldn't work for a variable number of items.


      I could put them into database tables but that would require programming.


      Joseph Faisal Nusairat suggested I create a custom tag. He wrote:


      Have something in your repository like - 
      
      MenuItem.1 = Traditional
      MenuItem.2 = Colonial
      
      etc .... then just feed into the tag MenuItem .... and have it auto look for 1 , 2 , 3 ... etc ... until it reaches null. This solution obviously is not ideal since it relies on making sure no one just deletes one. Alternatively you could do a comma or pipe separated list. 
      
      In the end it is going to require some custom parsing.




      Does anyone have an example of such as custom tag or have a better solution?