Thanks Geoff for the link, it's more or less what I wanted to do but I've found a way to do what I want by manipulating DOM.
For information, in case it can help someone, here is the final HTML code I wanted : <div class="single-error-message"> <p>The field must be 16 digits long</p> <p> <label for="testField" id="testField-label"> Test : </label> <input type="text" name="testField" id="testField" value=""> <img src="/sips-pp-web/assets/tapestry/5.1.0.5/spacer.gif" alt="Cross indicating that this form field is in error" class="t-error-icon" id="testField:icon"> </p> </div> I've created a custom ValidationDecorator and manage to obtain the code above by overriding the insideLabel() method : @Override public void insideLabel(Field field, Element element) { if (field == null) return; if (inError(field)){ //Label's container is retrieved Element parent = element.getContainer(); //A new div is created into this container Element divElement = parent.element("div","class","single-error-message"); //The error message is retrieved and added to this new element ValidationTracker tracker = environment.peekRequired(ValidationTracker.class); Element content = divElement.element("p"); content.text(tracker.getError(field)); //As the parent can't be moved into one of its children, we must //extract the child first divElement.moveBefore(parent); //Then, the field is added as the last child in order to be displayed //after the error message. But as moveToBottom method cause problems, //We finally use a workaround with two calls to moveToTop. parent.moveToTop(divElement); content.moveToTop(divElement); } } I'm sure that a better way to do that exist but this one works (at least). Thomas. 2010/7/13 Geoff Callender <geoff.callender.jumpst...@gmail.com> > Would this work for you? It uses css to show/hide the error message field. > > > http://jumpstart.doublenegative.com.au/jumpstart/examples/input/novalidationbubbles1 > > HTH, > > Geoff > > On 14/07/2010, at 2:53 AM, Thomas Cucchietti wrote: > > > Hi Pablo, > > > > Here is a link to the Thiago's message (using markmail) : > > > > > http://markmail.org/message/ivb3ludzqg4zhzf3?q=T5+overriding+validationdecorator > > > > Thomas. > > > > 2010/7/13 Pablo dos Reis <pablodosr...@gmail.com> > > > >> Hi Thomas, > >> > >> Do you still have the link to post of Thiago? > >> > >> I' m looking for the post, but I have not found yet. > >> > >> > >> tks, > >> > >> 2010/7/13 Thomas Cucchietti <thomas.cucchie...@gmail.com> > >> > >>> Nobody has an idea about this problem? > >>> > >>> > >>> 2010/7/8 Thomas Cucchietti <thomas.cucchie...@gmail.com> > >>> > >>>> Hi everybody! > >>>> > >>>> I'm facing a problem I can't resolve, even after hours of reflexion > and > >>>> tests so I'm asking for help :) > >>>> > >>>> Here is my need : I would like to display the error message > >> corresponding > >>>> to each field of my form just above the label of this field. > >>>> > >>>> I've made some research and have found a very interesting post of > >> Thiago > >>>> about custom ValidationDecorator. > >>>> > >>>> I created mine, added it to my AppModule and everything should be ok. > >>>> > >>>> Here is the specific part of my ValidationDecorator : > >>>> > >>>> @Override > >>>> public void beforeLabel(Field field) { > >>>> if (inError(field)) { > >>>> markupWriter.element("div", > >>>> "class", "single-error-message"); > >>>> ValidationTracker tracker = > >>>> environment.peekRequired(ValidationTracker.class); > >>>> markupWriter.write(tracker.getError(field)); > >>>> markupWriter.end(); > >>>> > >>>> } > >>>> } > >>>> > >>>> The problem is that, for a field in error (i.e. required field that is > >>>> empty), when the label renders itself and call the beforeLabel() > >> method, > >>> the > >>>> field is not considered as in error (inError(field) returns false). > >>>> > >>>> I've checked and in the insideLabel() method, the field is in error > but > >>>> it's too late to use markupwriter as the label is already rendered. > >>>> > >>>> Finally I tried to manipulate DOM but it doesn't work too... (I'll > >>>> eventually post the corresponding code later but it's not the main > >> point > >>> of > >>>> this mail). > >>>> > >>>> So my question is : is there a way to recognize that the field is in > >>> error > >>>> in the beforeLabel() method? > >>>> > >>>> Thanks in advance for help! > >>>> > >>>> Thomas > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>> > >> > >> > >> > >> -- > >> Pablo Henrique dos Reis > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >