• Post Reply Bookmark Topic Watch Topic
  • New Topic

setting f:validatelength dynamically does not work

 
Karl Kilden
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use a bean and EL Expression to set the min and max values on f:validatelength it simply does not work. It breaks the functionality in the form so it can't be submitted...

When I outputtext the values they do come out as legit numbers and hardcoding those numbers work fine.

My guess it that it somehow lacks the required connection to beans at that time in the lifecycle or something? (I'm pretty much a beginner). Example below is example of what I want to do


I tried using < a4j:keepAlive > on the bean but I couldn't get that to work.

I am using JSF 1.2 with Richfaces 3.3.3 and Seam 2.

Hopefully someone has a clue here. And a good way to achieve this using another tag then that's fine as well! Thanks for reading.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your tags looks fine and can you post your myBean ? I want to see getter of min and max Size there .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and Welcome to JavaRanch Karl Kilden .
 
Tim Holloway
Bartender
Posts: 18418
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Karl!

Your suspicion is basically correct. I've run into the exact same problem myself.

Probably the simplest way to deal with this is to code a custom validator method in your backing bean (not as a separate validator class), and have that method check the bean's password size properties directly. Also, it's not a bad idea to set up the maxlength attribute on your inputSecret control. That way the user cannot even type in a password that's too long!
 
Karl Kilden
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I screwed up a little while using the test method posted here.

my real bean is a list of objects used with seam home entity didn't post it because seeing how a much simpler bean didn't work either I figured it was unrelated to seam.

However, I saw an error in my testBean and now it works but the not when I get the value from my seam object. This seems related to seam entityHome so it's not directly related to jsf. Should I still post my code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!