Hi

You can use another enumeration constant Language.NONE or use an html radio (as 
a dummy button already selected) and it will be ignored.

For showing localized messages, you can use a message catalog as mentioned in 
the documentation

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/util/EnumSelectModel.html

A basic select model for a particular Enum type. The labels for each Enum are 
drawn from the Enum instance name and the provides message catalog:

As key ClassName.name if present. The class name excludes the package portion. 
Ex: "ElementType.LOCAL_VARIABLE"
As key name if present, i.e., "LOCAL_VARIABLE".
As a user-presentable version of the name, i.e., "Local Variable".


regards
Taha


On Jan 17, 2013, at 7:25 PM, nquirynen wrote:

> Hi,
> 
> I have a RadioGroup with options based on an enum (Language).
> 
> *.tml*
> 
> <t:radiogroup t:value="selectedLanguage">
>      <t:loop t:source="languages" t:value="loopLanguage">
>          <t:radio t:value="language" />
> ${format:labeled=language.description}
>      </t:loop>
> </t:radiogroup>
> 
> *.class*
> 
> @Property
> private Language selectedLanguage;
> 
> @Property
> private Language loopLanguage;
> 
> public Language[] getLanguages() {
>   return new Language[] { Language.NL, Language.FR, Language.DE };
> }
> 
> Now I want to add a radio option representing a null value (no language
> selected);
> 
> So I added this to my radiogroup (after the loop):
> 
> <t:radio t:value="null" /> ${message:unknown}
> 
> 
> Then I get this exception:
> 
> /org.apache.tapestry5.ioc.util.UnknownValueException
> Input 'on' does not identify a value from enumerated type
> be.pensionarchitects.admindb.model.language.Language.
> 
> availableValues
> 
>    be.pensionarchitects.admindb.model.language.Language enum constants:
> 
>        DE
>        EN
>        FR
>        NL/
> 
> I understand the problem here. But seeing my use case, is the only solution
> to use a String and the Language enum String representations as values for
> my radiogroup? Or can this be solved in an other way?
> 
> Nathan
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Radiogroup-with-Enum-value-and-option-with-NULL-value-tp5719355.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

Reply via email to