I'm using Apache Wicket 9. I'm looking at field validations and feedback messages and I'm wondering how to do this properly:

I've got a form of the nature

    <input type="password" wicket:id="field1" label="password"/>
    <span wicket:id="feedback">field feedback will be here</span>

    <input type="password" wicket:id="field2" label="confirm password"/>
    <span wicket:id="feedback">field feedback will be here</span>

    <hr>

    <span wicket:id="feedback">global feedback will be here</span>

---

ComponentFeedbackMessageFilter:

https://nightlies.apache.org/wicket/guide/9.x/single.html#_displaying_feedback_messages_and_filtering_them

works well for the field feedbacks.

But that supposing that I'm checking that password and confirm password should match, and if they don't I post an error message in the 'global feedback' feedback that is for the form.

What would be a good way to do that? As it seemed ContainerFeedbackMessageFilter would simply include messages from all the child fields. I need to flag a ValidationError or FeedbackMessage as 'global' and pass that such that I can perhaps construct a custom FeedbackMessageFilter to look for 'global' error messages, e.g. to say that password and confirm password do not match.

But it'd seem FeedbackMessage passed in public interface IFeedbackMessageFilter

boolean accept(FeedbackMessage message);

And FeedbackMessage neither contains a link to the original ValidationError() nor can a custom FeedbackMessage be passed sub-classed say in ValidationError.setMessage(String message). e.g. that setMessage uses a custom sub-classed FeedbackMessage instead of a string.

Thanks in advance




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to