Remove error message for a specific component
Hi, How can I remove error message for a specific component? In the Component.class, it checks that the component is valid the following way: public final boolean hasErrorMessage() { return Session.get().getFeedbackMessages().hasErrorMessageFor(this); } I need to remove error message for specific components to make them valid. Thanks, Anna
Re: Remove error message for a specific component
You can use FormComponent#valid() method to make them valid, an still present the validations messages. On Mon, Mar 15, 2010 at 2:59 PM, Anna Simbirtsev asimbirt...@gmail.comwrote: Hi, How can I remove error message for a specific component? In the Component.class, it checks that the component is valid the following way: public final boolean hasErrorMessage() { return Session.get().getFeedbackMessages().hasErrorMessageFor(this); } I need to remove error message for specific components to make them valid. Thanks, Anna -- Pedro Henrique Oliveira dos Santos
Re: Remove error message for a specific component
getsession().getfeedbackmessages().clear(new ifeedbackmessagefilter() { accept(feedbackmessagefilter f) { f.getreporter()==component; } -igor On Mon, Mar 15, 2010 at 10:59 AM, Anna Simbirtsev asimbirt...@gmail.com wrote: Hi, How can I remove error message for a specific component? In the Component.class, it checks that the component is valid the following way: public final boolean hasErrorMessage() { return Session.get().getFeedbackMessages().hasErrorMessageFor(this); } I need to remove error message for specific components to make them valid. Thanks, Anna - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Remove error message for a specific component
Thanks I have another question. I use the following code to validate a field onblur event. I have couple of those fields. When the first field is validated, it displays error message for it. But when the second field is invalid, it displays error message for it, and removes error message for the first field. Also once I click submit, it does not show error messages for these fields. field1.add(new AjaxFormComponentUpdatingBehavior(onblur) { private static final long serialVersionUID = 1L; protected void onUpdate(AjaxRequestTarget target) { Pattern pattern = Pattern.compile([0-9]*); if (data.getField1()!= null !pattern.matcher(data.getField1()).matches()) { error(Field contains invalid characters.); target.addComponent(feedback); field1.add(new SimpleAttributeModifier( class, error)); } else { field1.add(new SimpleAttributeModifier( class, )); } target.addComponent(field1); } }); On Mon, Mar 15, 2010 at 2:25 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: getsession().getfeedbackmessages().clear(new ifeedbackmessagefilter() { accept(feedbackmessagefilter f) { f.getreporter()==component; } -igor On Mon, Mar 15, 2010 at 10:59 AM, Anna Simbirtsev asimbirt...@gmail.com wrote: Hi, How can I remove error message for a specific component? In the Component.class, it checks that the component is valid the following way: public final boolean hasErrorMessage() { return Session.get().getFeedbackMessages().hasErrorMessageFor(this); } I need to remove error message for specific components to make them valid. Thanks, Anna - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Anna Simbirtsev (416) 729-7331