novotny75 (7) [Avatar] Offline
#1
Normally I was using a FeedbackPanel to display all the messages at the top of the form by default. However, our deisgner wants to display a single message at the top of the form: "Please fill out all required fields" and apply a CSS class to the "li" that contains the required component.

So before we have form fields that looks like:
<!-- <br /> ... <br /> <li> <br /> <label for="username">Create Username<em>*</em></label> <br /> <input id="username" name="username" type="text" wicket:id="dto.username"/> <br /> </li> <br /> ... <br /> <br /> and in case of an error we want to display the following <br /> <br /> <li class="error"> <br /> <label for="username">Create Username<em>*</em></label> <br /> <input id="username" name="username" type="text" wicket:id="dto.username"/> <br /> </li> <br /> -->
I'm struggling to figure out how to do this since I don't want to add behavior to the component itself, I want to adjust the class of the outer "li" tag. Maybe I can write a javascript function to do that, but then I don't know what class I need to subclass to apply the javascript function-- and it needs some argument to indicate which "li" tag to modify. Like if it had the wicket:id of the component "dto.username" maybe it could then search for the outer "li" and adjust it.
Any ideas are greatly appreciated! I also have a lot of required form fields and a lot of wicket panels, so the best approach would also require minimal coding changes too.

Thanks, Jason