• Post Reply Bookmark Topic Watch Topic
  • New Topic

Change <input> tag after validation/conversion-Exception

 
Pascal Lochmann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 18414
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pascal Lochmann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!