You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anna Simbirtsev <as...@gmail.com> on 2010/03/15 18:59:41 UTC

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

Posted by Pedro Santos <pe...@gmail.com>.
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 <as...@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
>



-- 
Pedro Henrique Oliveira dos Santos

Re: Remove error message for a specific component

Posted by Anna Simbirtsev <as...@gmail.com>.
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 <ig...@gmail.com>wrote:

> getsession().getfeedbackmessages().clear(new ifeedbackmessagefilter() {
>  accept(feedbackmessagefilter f) { f.getreporter()==component; }
>
>
> -igor
>
>
> On Mon, Mar 15, 2010 at 10:59 AM, Anna Simbirtsev <as...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Anna Simbirtsev
(416) 729-7331

Re: Remove error message for a specific component

Posted by Igor Vaynberg <ig...@gmail.com>.
getsession().getfeedbackmessages().clear(new ifeedbackmessagefilter() {
  accept(feedbackmessagefilter f) { f.getreporter()==component; }


-igor


On Mon, Mar 15, 2010 at 10:59 AM, Anna Simbirtsev <as...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org