aspose file tools*
The moose likes JSF and the fly likes Validation Problems on f:selectItems selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Validation Problems on f:selectItems selection" Watch "Validation Problems on f:selectItems selection" New topic
Author

Validation Problems on f:selectItems selection

Andreas Scheucher
Greenhorn

Joined: Oct 19, 2010
Posts: 10
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

Joined: Dec 17, 2010
Posts: 23
Andi,

Can you translate the error message to english? It may allow more people to try to help troubleshoot the error.
Andreas Scheucher
Greenhorn

Joined: Oct 19, 2010
Posts: 10
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

Joined: Oct 19, 2010
Posts: 10
I checked now. The translation to english: The selected value is invalid

I also added the translation to the original posting.
Andreas Scheucher
Greenhorn

Joined: Oct 19, 2010
Posts: 10
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

Joined: Jun 25, 2001
Posts: 16308
    
  22

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Andreas Scheucher
Greenhorn

Joined: Oct 19, 2010
Posts: 10
Thanks a lot!

Works now like a charme
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation Problems on f:selectItems selection