You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mathilde Pellerin <ma...@statlife.fr> on 2011/06/17 09:34:33 UTC

infos message not rendering in feedback panel whereas error messages are rendered

Hi all,

I have two little problems with feedback panel.
The first one : I have a feedback panel in a form  which render well error
messages of the form but which not render info messages. I thought feedback
panel render all types of messages, but maybe there is some configuration to
do to render info messages?
I didn't find any onInfo() method to override like method onError()...
This is the code for the feedback panel :
        final FeedbackPanel feedbackPanelPassword = new
FeedbackPanel("feedbackPanelPassword");
        feedbackPanelPassword.setOutputMarkupId(true);
        formNouveauPwd.add(feedbackPanelPassword);

and the code which send info message :
        final AjaxButton submitButtonPwd = new
AjaxButton("boutonModifierPwd"){

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
                String oldPwd = oldPwdField.getValue();

                if(!oldPwd.equals(membre.getPassword()))
                    error("Ancien mot de passe incorrect.");
                else
                {
                    membre.setPassword(newPwdField.getValue());

SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
                    info("Nouveau mot de passe bien enregistré");
                }
            }

            @Override
            protected void onError(AjaxRequestTarget target, Form<?> form) {
                target.addComponent(feedbackPanelPassword);
            }
        };

And the second little problem : I have another form with textfield wich
accept only Integer. Validation works well when I submit the form : if I put
a letter in the textfield, I have an error message in my feedback panel. But
in console I can see that error message appear as soon as I put the letter
in the textfield. So I would like to render it as soon as user enter a
letter in the textfield, not only when user submit the form... I thought to
override onError() method of the form, but there is no AjaxRequestTarget in
that method, so I can't use target.addComponent(myFeedbackPanel) like I do
for the submit button.
Is there a way to do this?

Thanks

-- 
*Mathilde Pellerin*
Ingénieur en développement de logiciel

STATLIFE
tel : 01.42.11.64.88
mail : mathilde.pellerin@statlife.fr

Re: infos message not rendering in feedback panel whereas error messages are rendered

Posted by Igor Vaynberg <ig...@gmail.com>.
override onerror() in the behavior and add the feedback panel

-igor

On Fri, Jun 17, 2011 at 1:31 AM, Mathilde Pellerin
<ma...@gmail.com> wrote:
> I already have AjaxFormComponentUpdatingBehavior for the text field, so I
> try to add feedback panel like this :
>    @SuppressWarnings("serial")
>    class AjaxFormComponentValidationTextField extends
> AjaxFormComponentUpdatingBehavior{
>        private Component feedbackPanel;
>        private Component boutonAActiver;
>
>        public AjaxFormComponentValidationTextField(String event, Component
> boutonAActiver,
>                Component feedbackAAjouter) {
>            super(event);
>            this.boutonAActiver = boutonAActiver;
>            this.feedbackPanel = feedbackAAjouter;
>        }
>
>        @Override
>        protected void onUpdate(AjaxRequestTarget target) {
>            boutonAActiver.setEnabled(true);
>            target.addComponent(boutonAActiver);
>            target.addComponent(feedbackPanel);
>        }
>    }
>
> and
>         tailleField.add(new AjaxFormComponentValidationTextField("onkeyup",
> boutonEnregistrerInfos,
>                feedbackPanelTaille));
>
> but it doesn't work : error is still rendered when I submit the form...
>
>
> 2011/6/17 Martin Grigorov <mg...@apache.org>
>
>> use AjaxFormComponentUpdatingBehavior for the TextField
>>
>> On Fri, Jun 17, 2011 at 11:08 AM, Mathilde Pellerin
>> <ma...@statlife.fr> wrote:
>> > Thanks a lot, it works well.
>> >
>> > Any idea for the second question ?
>> >
>> > I have another form with textfield wich accept only Integer. Validation
>> > works well when I submit the form : if I put a letter in the textfield, I
>> > have an error message in my feedback panel. But in console I can see that
>> > error message appear as soon as I put the letter in the textfield. So I
>> > would like to render it as soon as user enter a letter in the textfield,
>> not
>> > only when user submit the form... I thought to override onError() method
>> of
>> > the form, but there is no AjaxRequestTarget in that method, so I can't
>> use
>> > target.addComponent(
>> > myFeedbackPanel) like I do for the submit button.
>> > Is there a way to do this?
>> >
>> >
>> > 2011/6/17 İzlem Gözükeleş <iz...@gmail.com>
>> >
>> >> you should  add target.addComponent(feedbackPanelPassword) for onSubmit
>> >> method.
>> >>
>> >>
>> >> On Fri, Jun 17, 2011 at 10:34 AM, Mathilde Pellerin <
>> >> mathilde.pellerin@statlife.fr> wrote:
>> >>
>> >> >            @Override
>> >> >            protected void onSubmit(AjaxRequestTarget target, Form<?>
>> >> form)
>> >> > {
>> >> >                String oldPwd = oldPwdField.getValue();
>> >> >
>> >> >                if(!oldPwd.equals(membre.getPassword()))
>> >> >                    error("Ancien mot de passe incorrect.");
>> >> >                else
>> >> >                {
>> >> >                    membre.setPassword(newPwdField.getValue());
>> >> >
>> >> > SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
>> >> >                    info("Nouveau mot de passe bien enregistré");
>> >> >
>> >> you should  add target.addComponent(feedbackPanelPassword);
>> >>
>> >>
>> >> >                }
>> >> >            }
>> >> >
>> >> >
>> >>
>> >> --
>> >> *Mathilde Pellerin*
>> >> Ingénieur en développement de logiciel
>> >>
>> >> STATLIFE
>> >> tel : 01.42.11.64.88
>> >> mail : mathilde.pellerin@statlife.fr
>> >>
>> >>
>> >>
>> >>   <http://www.viadeo.com/fr/profile/mathilde.pellerin>
>> >> <http://fr.linkedin.com/in/mathildepellerin>
>> >>
>> >
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
>  Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
> 06.60.78.79.03   E-mail
> : mathilde.pellerin@gmail.com   Mon CV en ligne :
> <http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/    Mes
> liens :  <http://www.viadeo.com/fr/profile/mathilde.pellerin>
> <http://fr.linkedin.com/in/mathildepellerin>
>

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


Re: infos message not rendering in feedback panel whereas error messages are rendered

Posted by Mathilde Pellerin <ma...@gmail.com>.
I already have AjaxFormComponentUpdatingBehavior for the text field, so I
try to add feedback panel like this :
    @SuppressWarnings("serial")
    class AjaxFormComponentValidationTextField extends
AjaxFormComponentUpdatingBehavior{
        private Component feedbackPanel;
        private Component boutonAActiver;

        public AjaxFormComponentValidationTextField(String event, Component
boutonAActiver,
                Component feedbackAAjouter) {
            super(event);
            this.boutonAActiver = boutonAActiver;
            this.feedbackPanel = feedbackAAjouter;
        }

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            boutonAActiver.setEnabled(true);
            target.addComponent(boutonAActiver);
            target.addComponent(feedbackPanel);
        }
    }

and
         tailleField.add(new AjaxFormComponentValidationTextField("onkeyup",
boutonEnregistrerInfos,
                feedbackPanelTaille));

but it doesn't work : error is still rendered when I submit the form...


2011/6/17 Martin Grigorov <mg...@apache.org>

> use AjaxFormComponentUpdatingBehavior for the TextField
>
> On Fri, Jun 17, 2011 at 11:08 AM, Mathilde Pellerin
> <ma...@statlife.fr> wrote:
> > Thanks a lot, it works well.
> >
> > Any idea for the second question ?
> >
> > I have another form with textfield wich accept only Integer. Validation
> > works well when I submit the form : if I put a letter in the textfield, I
> > have an error message in my feedback panel. But in console I can see that
> > error message appear as soon as I put the letter in the textfield. So I
> > would like to render it as soon as user enter a letter in the textfield,
> not
> > only when user submit the form... I thought to override onError() method
> of
> > the form, but there is no AjaxRequestTarget in that method, so I can't
> use
> > target.addComponent(
> > myFeedbackPanel) like I do for the submit button.
> > Is there a way to do this?
> >
> >
> > 2011/6/17 İzlem Gözükeleş <iz...@gmail.com>
> >
> >> you should  add target.addComponent(feedbackPanelPassword) for onSubmit
> >> method.
> >>
> >>
> >> On Fri, Jun 17, 2011 at 10:34 AM, Mathilde Pellerin <
> >> mathilde.pellerin@statlife.fr> wrote:
> >>
> >> >            @Override
> >> >            protected void onSubmit(AjaxRequestTarget target, Form<?>
> >> form)
> >> > {
> >> >                String oldPwd = oldPwdField.getValue();
> >> >
> >> >                if(!oldPwd.equals(membre.getPassword()))
> >> >                    error("Ancien mot de passe incorrect.");
> >> >                else
> >> >                {
> >> >                    membre.setPassword(newPwdField.getValue());
> >> >
> >> > SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
> >> >                    info("Nouveau mot de passe bien enregistré");
> >> >
> >> you should  add target.addComponent(feedbackPanelPassword);
> >>
> >>
> >> >                }
> >> >            }
> >> >
> >> >
> >>
> >> --
> >> *Mathilde Pellerin*
> >> Ingénieur en développement de logiciel
> >>
> >> STATLIFE
> >> tel : 01.42.11.64.88
> >> mail : mathilde.pellerin@statlife.fr
> >>
> >>
> >>
> >>   <http://www.viadeo.com/fr/profile/mathilde.pellerin>
> >> <http://fr.linkedin.com/in/mathildepellerin>
> >>
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pellerin@gmail.com   Mon CV en ligne :
<http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/    Mes
liens :  <http://www.viadeo.com/fr/profile/mathilde.pellerin>
<http://fr.linkedin.com/in/mathildepellerin>

Re: infos message not rendering in feedback panel whereas error messages are rendered

Posted by Martin Grigorov <mg...@apache.org>.
use AjaxFormComponentUpdatingBehavior for the TextField

On Fri, Jun 17, 2011 at 11:08 AM, Mathilde Pellerin
<ma...@statlife.fr> wrote:
> Thanks a lot, it works well.
>
> Any idea for the second question ?
>
> I have another form with textfield wich accept only Integer. Validation
> works well when I submit the form : if I put a letter in the textfield, I
> have an error message in my feedback panel. But in console I can see that
> error message appear as soon as I put the letter in the textfield. So I
> would like to render it as soon as user enter a letter in the textfield, not
> only when user submit the form... I thought to override onError() method of
> the form, but there is no AjaxRequestTarget in that method, so I can't use
> target.addComponent(
> myFeedbackPanel) like I do for the submit button.
> Is there a way to do this?
>
>
> 2011/6/17 İzlem Gözükeleş <iz...@gmail.com>
>
>> you should  add target.addComponent(feedbackPanelPassword) for onSubmit
>> method.
>>
>>
>> On Fri, Jun 17, 2011 at 10:34 AM, Mathilde Pellerin <
>> mathilde.pellerin@statlife.fr> wrote:
>>
>> >            @Override
>> >            protected void onSubmit(AjaxRequestTarget target, Form<?>
>> form)
>> > {
>> >                String oldPwd = oldPwdField.getValue();
>> >
>> >                if(!oldPwd.equals(membre.getPassword()))
>> >                    error("Ancien mot de passe incorrect.");
>> >                else
>> >                {
>> >                    membre.setPassword(newPwdField.getValue());
>> >
>> > SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
>> >                    info("Nouveau mot de passe bien enregistré");
>> >
>> you should  add target.addComponent(feedbackPanelPassword);
>>
>>
>> >                }
>> >            }
>> >
>> >
>>
>> --
>> *Mathilde Pellerin*
>> Ingénieur en développement de logiciel
>>
>> STATLIFE
>> tel : 01.42.11.64.88
>> mail : mathilde.pellerin@statlife.fr
>>
>>
>>
>>   <http://www.viadeo.com/fr/profile/mathilde.pellerin>
>> <http://fr.linkedin.com/in/mathildepellerin>
>>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: infos message not rendering in feedback panel whereas error messages are rendered

Posted by Mathilde Pellerin <ma...@statlife.fr>.
Thanks a lot, it works well.

Any idea for the second question ?

I have another form with textfield wich accept only Integer. Validation
works well when I submit the form : if I put a letter in the textfield, I
have an error message in my feedback panel. But in console I can see that
error message appear as soon as I put the letter in the textfield. So I
would like to render it as soon as user enter a letter in the textfield, not
only when user submit the form... I thought to override onError() method of
the form, but there is no AjaxRequestTarget in that method, so I can't use
target.addComponent(
myFeedbackPanel) like I do for the submit button.
Is there a way to do this?


2011/6/17 İzlem Gözükeleş <iz...@gmail.com>

> you should  add target.addComponent(feedbackPanelPassword) for onSubmit
> method.
>
>
> On Fri, Jun 17, 2011 at 10:34 AM, Mathilde Pellerin <
> mathilde.pellerin@statlife.fr> wrote:
>
> >            @Override
> >            protected void onSubmit(AjaxRequestTarget target, Form<?>
> form)
> > {
> >                String oldPwd = oldPwdField.getValue();
> >
> >                if(!oldPwd.equals(membre.getPassword()))
> >                    error("Ancien mot de passe incorrect.");
> >                else
> >                {
> >                    membre.setPassword(newPwdField.getValue());
> >
> > SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
> >                    info("Nouveau mot de passe bien enregistré");
> >
> you should  add target.addComponent(feedbackPanelPassword);
>
>
> >                }
> >            }
> >
> >
>
> --
> *Mathilde Pellerin*
> Ingénieur en développement de logiciel
>
> STATLIFE
> tel : 01.42.11.64.88
> mail : mathilde.pellerin@statlife.fr
>
>
>
>   <http://www.viadeo.com/fr/profile/mathilde.pellerin>
> <http://fr.linkedin.com/in/mathildepellerin>
>

Re: infos message not rendering in feedback panel whereas error messages are rendered

Posted by İzlem Gözükeleş <iz...@gmail.com>.
you should  add target.addComponent(feedbackPanelPassword) for onSubmit
method.


On Fri, Jun 17, 2011 at 10:34 AM, Mathilde Pellerin <
mathilde.pellerin@statlife.fr> wrote:

>            @Override
>            protected void onSubmit(AjaxRequestTarget target, Form<?> form)
> {
>                String oldPwd = oldPwdField.getValue();
>
>                if(!oldPwd.equals(membre.getPassword()))
>                    error("Ancien mot de passe incorrect.");
>                else
>                {
>                    membre.setPassword(newPwdField.getValue());
>
> SessionE4N.get().setMembre(serviceMembre.saveOne(membre));
>                    info("Nouveau mot de passe bien enregistré");
>
you should  add target.addComponent(feedbackPanelPassword);


>                }
>            }
>
>