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 > > > > > > > >