I'm trying to create a custom hibernate validator , based on bradhouse's 
solution in this StackOverflow 
thread<http://stackoverflow.com/questions/1972933/cross-field-validation-with-hibernate-validator-jsr-303>.
  I'm passing in the field name that I would like the error message to be 
associated with to addNode.  Unfortunately, my ComponentFeedbackMessageFilter 
that is associated with the field in wicket does not know that the message was 
directed to it.  I know wicket is getting the validation error from Hibernate, 
because it shows up in my unfiltered feedback panel.

Could it be that I'm adding the feedback messages from a Behavior instead of 
from a FeedbackPanel directly?  The core of the Behavior, where the messages 
get attached , is this:

@Override
public void afterRender(Component component) {
      FormComponent<?> fc = (FormComponent<?>)component;
      Response r = component.getResponse();

      FeedbackMessages messages = fc.getSession().getFeedbackMessages();

      if (messages.hasMessageFor(component)) {
            r.write("<ul class=\"FeedbackStyle\">");
            IFeedbackMessageFilter filter = new 
ComponentFeedbackMessageFilter(component);
            for (FeedbackMessage message : messages.messages(filter)) {
                  r.write("<li class=\"feedbackPanel");
                  r.write(message.getLevelAsString().toUpperCase());
                  r.write("\">");
                  
r.write(Strings.escapeMarkup(message.getMessage().toString()));
                  r.write("</li>");
            }
            r.write("</ul>");
      }
      r.write("</span>");
}

Thanks,

Keith Wooldridge


Reply via email to