Two Laptop Bag
The moose likes JSF and the fly likes Change <input> tag after validation/conversion-Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Change <input> tag after validation/conversion-Exception" Watch "Change <input> tag after validation/conversion-Exception" New topic
Author

Change <input> tag after validation/conversion-Exception

Pascal Lochmann
Greenhorn

Joined: May 06, 2010
Posts: 5
Hello Everybody,

i have a really simple problem and didn't find a working solution - it drives me mad!

Problem:
If a ValidationException/ConversionException is trhown by my validators/converters the regarding <input> -element in the page must be changed e.g. the background-color is set to red or style-class "invalid" ist set.

How to accomplish this? (Solution must work for InputText-Elements in a table)

Best Regards
Pascal
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14487
    
    7

Normally I pair the input control with a "message for=" tag, and that tag has options for different styles depending on error severity. I'm sure there's a way to highlight the input control itself, but I can't think of an easy one offhand.

The main problem with simply highlighting a bad input is that it doesn't explain itself like a message element would.


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

Joined: May 06, 2010
Posts: 5
Hello Tim,

thanks for your reply.

I already have message-elements for the inputs. (And it works)

Nevertheless the users/ my costumers want this feature...

Regards
Pascal
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 120

Hi Pascal Lochmann,

use a phase listener with phase id "Validation phase"

add the logic in after phase, iterate the component find the error messages for every component if exist then update the style class for that component which accomplish your requirement.

Sun Certified Java Programmer with 93 percent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change <input> tag after validation/conversion-Exception
 
Similar Threads
onClick function call with a scriptlet parameter
How can i share the session between webapps?
Java Date problem with Japanese locale
form displaying the last value from the form bean?
Jsp not running