• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation Problems on f:selectItems selection

 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am relatively new to JSF 2.0 and struggle around with Validation in my case.

my Facelet:




in my backing bean:


the validation problem:


Translation to english: The selected value is invalid

Btw: Bundesland stands for one of 9 organizational areas within Austria. Arbeitsgeber means employee.
Sorry for this horrible language mixture.

Anybody any ideas? I am running out of them

thanks in advance,
Andi

Edit: fixed a typo and added a translation to the error message.
 
John Tannel
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andi,

Can you translate the error message to english? It may allow more people to try to help troubleshoot the error.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ups! if I remember correctly it stand's for: invalid value
I will check in my office tomorrow.

greets

Edit: fixed type. iPhone touchkeybordes 5 minutes before falling asleep can be tricky ;)
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked now. The translation to english: The selected value is invalid

I also added the translation to the original posting.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the problem

I initialized the select items with the enum values, but I should have used the string representation of them.

The solution is:

Maybe this helps somebody else.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18281
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I think your real problem was that your "set" method originally took the entire SelectItem as a parameter. It should have taken a variable of the enum type.

You can create a SelectItem sequence that consists of (enum, String) pairs and I do it sometimes. You just have to do it using the proper set/get method signatures. But converting the enum to its string equivalents will work.
 
Andreas Scheucher
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!

Works now like a charme
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic