You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kenneth NA <ri...@live.se> on 2009/07/18 12:32:46 UTC

error(validatable)

 

Let's rephrase my problem.

 

I connect a validator to a TextField in a DataView (inside populateItem() and connect a ComponentFeedbackPanel  to it.


                final TextField tf = new TextField("data", new PropertyModel(row, "data"));
                final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", tf);
                tfFeedback.setOutputMarkupId(true);
                item.add(tf);
                item.add(tfFeedback);

And I also have both in the HTML markup


                    <tr wicket:id="rows">
                        <td nowrap><input wicket:id="data" type="text" /><span wicket:id="fb"></span></td>
                    </tr>


Is this enough for the error reported in in onValidate() for the validator connected to the field 

with error(ivalidatable); should be displayed next to the field or does it require something more?

 

                error(validatable, "an_error_occured");


Why I wonder is that it is not displayed next to the field, it is displayed in the "common" feedback panel.

 

/Kenneth

 

 

 

 

_________________________________________________________________
Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

Re: error(validatable)

Posted by Igor Vaynberg <ig...@gmail.com>.
On Sat, Jul 18, 2009 at 9:19 AM, Kenneth NA<ri...@live.se> wrote:
>
> You mean this row which I already have in my code?
>
>
> dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());

so i assume that since you have called this your have implemented
proper hashcode and equals in your model?

-igor


>
> Please, can someone test the actual quickstart I added before and once again
> added
> and give me a solution. I have sit with this problem for atleast 1,5 week
> now and
> I really though wicket was an easy framework to use.
>
> - Kenneth
>
>> From: igor.vaynberg@gmail.com
>> Date: Sat, 18 Jul 2009 09:14:24 -0700
>> Subject: Re: error(validatable)
>> To: users@wicket.apache.org
>>
>> you have to set an itemreusestrategy to reuse dataview items,
>> otherwise they are replaced by new ones every request and you lose
>> your feedback panel instance.
>>
>> -igor
>>
>> On Sat, Jul 18, 2009 at 3:32 AM, Kenneth NA<ri...@live.se> wrote:
>> >
>> >
>> >
>> > Let's rephrase my problem.
>> >
>> >
>> >
>> > I connect a validator to a TextField in a DataView (inside
>> > populateItem() and connect a ComponentFeedbackPanel  to it.
>> >
>> >
>> >                final TextField tf = new TextField("data", new
>> > PropertyModel(row, "data"));
>> >                final ComponentFeedbackPanel tfFeedback = new
>> > ComponentFeedbackPanel("fb", tf);
>> >                tfFeedback.setOutputMarkupId(true);
>> >                item.add(tf);
>> >                item.add(tfFeedback);
>> >
>> > And I also have both in the HTML markup
>> >
>> >
>> >                    <tr wicket:id="rows">
>> >                        <td nowrap><input wicket:id="data" type="text"
>> > /><span wicket:id="fb"></span></td>
>> >                    </tr>
>> >
>> >
>> > Is this enough for the error reported in in onValidate() for the
>> > validator connected to the field
>> >
>> > with error(ivalidatable); should be displayed next to the field or does
>> > it require something more?
>> >
>> >
>> >
>> >                error(validatable, "an_error_occured");
>> >
>> >
>> > Why I wonder is that it is not displayed next to the field, it is
>> > displayed in the "common" feedback panel.
>> >
>> >
>> >
>> > /Kenneth
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > _________________________________________________________________
>> > Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
>> >
>> > http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
> ________________________________
> kolla in resten av Windows LiveT. Inte bara e-post - Windows LiveT är mycket
> mer än din inkorg. Mer än bara meddelanden
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

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


RE: error(validatable)

Posted by Kenneth NA <ri...@live.se>.
 

You mean this row which I already have in my code? 

 

        dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());
 

Please, can someone test the actual quickstart I added before and once again added

and give me a solution. I have sit with this problem for atleast 1,5 week now and 

I really though wicket was an easy framework to use.

 

- Kenneth

 
> From: igor.vaynberg@gmail.com
> Date: Sat, 18 Jul 2009 09:14:24 -0700
> Subject: Re: error(validatable)
> To: users@wicket.apache.org
> 
> you have to set an itemreusestrategy to reuse dataview items,
> otherwise they are replaced by new ones every request and you lose
> your feedback panel instance.
> 
> -igor
> 
> On Sat, Jul 18, 2009 at 3:32 AM, Kenneth NA<ri...@live.se> wrote:
> >
> >
> >
> > Let's rephrase my problem.
> >
> >
> >
> > I connect a validator to a TextField in a DataView (inside populateItem() and connect a ComponentFeedbackPanel  to it.
> >
> >
> >                final TextField tf = new TextField("data", new PropertyModel(row, "data"));
> >                final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", tf);
> >                tfFeedback.setOutputMarkupId(true);
> >                item.add(tf);
> >                item.add(tfFeedback);
> >
> > And I also have both in the HTML markup
> >
> >
> >                    <tr wicket:id="rows">
> >                        <td nowrap><input wicket:id="data" type="text" /><span wicket:id="fb"></span></td>
> >                    </tr>
> >
> >
> > Is this enough for the error reported in in onValidate() for the validator connected to the field
> >
> > with error(ivalidatable); should be displayed next to the field or does it require something more?
> >
> >
> >
> >                error(validatable, "an_error_occured");
> >
> >
> > Why I wonder is that it is not displayed next to the field, it is displayed in the "common" feedback panel.
> >
> >
> >
> > /Kenneth
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _________________________________________________________________
> > Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
> > http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

_________________________________________________________________
Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

Re: error(validatable)

Posted by Igor Vaynberg <ig...@gmail.com>.
you have to set an itemreusestrategy to reuse dataview items,
otherwise they are replaced by new ones every request and you lose
your feedback panel instance.

-igor

On Sat, Jul 18, 2009 at 3:32 AM, Kenneth NA<ri...@live.se> wrote:
>
>
>
> Let's rephrase my problem.
>
>
>
> I connect a validator to a TextField in a DataView (inside populateItem() and connect a ComponentFeedbackPanel  to it.
>
>
>                final TextField tf = new TextField("data", new PropertyModel(row, "data"));
>                final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", tf);
>                tfFeedback.setOutputMarkupId(true);
>                item.add(tf);
>                item.add(tfFeedback);
>
> And I also have both in the HTML markup
>
>
>                    <tr wicket:id="rows">
>                        <td nowrap><input wicket:id="data" type="text" /><span wicket:id="fb"></span></td>
>                    </tr>
>
>
> Is this enough for the error reported in in onValidate() for the validator connected to the field
>
> with error(ivalidatable); should be displayed next to the field or does it require something more?
>
>
>
>                error(validatable, "an_error_occured");
>
>
> Why I wonder is that it is not displayed next to the field, it is displayed in the "common" feedback panel.
>
>
>
> /Kenneth
>
>
>
>
>
>
>
>
>
> _________________________________________________________________
> Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
> http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

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


RE: error(validatable)

Posted by Kenneth NA <ri...@live.se>.
Thanks for the information.

But if I don't have an Ajax button but a normal Button which submits the form? 

There is no target "variable" in the onValidate() method. 


I attached a quickstart earlier, where I showed that if I use Ajax onblur/onchange and use onError/onUpdate there

i nor problem of showing the error but when I the later click the "submit" button the error is NOT displayed

when they validator "kicks in". 

 

/Kenneth

 
> From: russellsimpkins@hotmail.com
> To: users@wicket.apache.org
> Subject: RE: error(validatable)
> Date: Sat, 18 Jul 2009 07:47:45 -0400
> 
> 
> Kenneth, 
> I over rode onError when I used the ComponentFeedbackPanel - when learning Wicket, I discovered that I had no idea my form errored out unless I did the following for my form. In this instance, I'm using the AjaxButton. I think the key is to add your feedback component to the target.
> 
> /** * Always, always add this - its much better to know there was an error. * @see org.apache.wicket.ajax.markup.html.form.AjaxButton#onError(org.apache.wicket.ajax.AjaxRequestTarget, org.apache.wicket.markup.html.form.Form) */@Overrideprotected void onError(AjaxRequestTarget target, Form tform) { super.onError(target, tform); form.error("Please make sure you have filled in all required fields."); // add the feedback - seems you have to do this to give feedback on errors. target.addComponent(emailFeedback); ....}
> 
> > From: rinocent@live.se
> > To: users@wicket.apache.org
> > Subject: error(validatable)
> > Date: Sat, 18 Jul 2009 12:32:46 +0200
> > 
> > 
> > 
> > 
> > Let's rephrase my problem.
> > 
> > 
> > 
> > I connect a validator to a TextField in a DataView (inside populateItem() and connect a ComponentFeedbackPanel to it.
> > 
> > 
> > final TextField tf = new TextField("data", new PropertyModel(row, "data"));
> > final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", tf);
> > tfFeedback.setOutputMarkupId(true);
> > item.add(tf);
> > item.add(tfFeedback);
> > 
> > And I also have both in the HTML markup
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Is this enough for the error reported in in onValidate() for the validator connected to the field 
> > 
> > with error(ivalidatable); should be displayed next to the field or does it require something more?
> > 
> > 
> > 
> > error(validatable, "an_error_occured");
> > 
> > 
> > Why I wonder is that it is not displayed next to the field, it is displayed in the "common" feedback panel.
> > 
> > 
> > 
> > /Kenneth
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _________________________________________________________________
> > Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
> > http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx
> 
> _________________________________________________________________
> Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
> http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TXT_MLOGEN_Local_Local_Restaurants_1x1
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

_________________________________________________________________
Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

RE: error(validatable)

Posted by Russell Simpkins <ru...@hotmail.com>.
Kenneth, 
I over rode onError when I used the ComponentFeedbackPanel - when learning Wicket, I discovered that I had no idea my form errored out unless I did the following for my form. In this instance, I'm using the AjaxButton. I think the key is to add your feedback component to the target.

/** * Always, always add this - its much better to know there was an error. * @see org.apache.wicket.ajax.markup.html.form.AjaxButton#onError(org.apache.wicket.ajax.AjaxRequestTarget, org.apache.wicket.markup.html.form.Form) */@Overrideprotected void onError(AjaxRequestTarget target, Form tform) {    super.onError(target, tform);    form.error("Please make sure you have filled in all required fields.");            // add the feedback - seems you have to do this to give feedback on errors.    target.addComponent(emailFeedback);    ....}

> From: rinocent@live.se
> To: users@wicket.apache.org
> Subject: error(validatable)
> Date: Sat, 18 Jul 2009 12:32:46 +0200
> 
> 
>  
> 
> Let's rephrase my problem.
> 
>  
> 
> I connect a validator to a TextField in a DataView (inside populateItem() and connect a ComponentFeedbackPanel  to it.
> 
> 
>                 final TextField tf = new TextField("data", new PropertyModel(row, "data"));
>                 final ComponentFeedbackPanel tfFeedback = new ComponentFeedbackPanel("fb", tf);
>                 tfFeedback.setOutputMarkupId(true);
>                 item.add(tf);
>                 item.add(tfFeedback);
> 
> And I also have both in the HTML markup
> 
> 
>                     
>                         
>                     
> 
> 
> Is this enough for the error reported in in onValidate() for the validator connected to the field 
> 
> with error(ivalidatable); should be displayed next to the field or does it require something more?
> 
>  
> 
>                 error(validatable, "an_error_occured");
> 
> 
> Why I wonder is that it is not displayed next to the field, it is displayed in the "common" feedback panel.
> 
>  
> 
> /Kenneth
> 
>  
> 
>  
> 
>  
> 
>  
> 
> _________________________________________________________________
> Med Windows Live kan du ordna, redigera och dela med dig av dina foton.
> http://www.microsoft.com/sverige/windows/windowslive/products/photo-gallery-edit.aspx

_________________________________________________________________
Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TXT_MLOGEN_Local_Local_Restaurants_1x1
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org