• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple question on SelectOneRadio

 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Very simple question. Can you use int as itemValue for selectOneRadio? Or is it only String and we need to convert it?

For example :



Of course, I have my Backing bean (UserForm.java) with a property int choice with getter/setter. ;)

Actually, it throws a misleading validation error saying "Value is not a valid option.". Was would be the best way to fix that? Thk!
 
vaithee sub
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use Integer type to add int values.
You may create a list of SelectItems with value as Integer & Label as String. You don't have to do any conversion then. The default conversion for Integer should handle this case. Moreover, the value for SelectItem should only be an Object and not a String.
 
Frederic Filiatrault
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice. Thk for your time on this. Really appreciated
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!