• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Change <input> tag after validation/conversion-Exception

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 121
Mac Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic