You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rafał Krupiński <r....@gmail.com> on 2012/11/02 20:58:15 UTC

Re: wicket-6 User friendly form validation with Wicket (stuq)

On Mon, Oct 29, 2012 at 8:36 AM, Martin Grigorov <mg...@apache.org> wrote:
>> Anyway, I would like to have a label for each validated input field
>> and put there any error messages related to that input.
>> I haven't found any example other than that old article by Daan van
>> Etten and that was for wicket 1.3.
>> Daan's solution used his own FeedbackLabel class and filtered
>> FeedbackPanel but it doesn't work with wicket 6.
>
> Please paste your code and compile errors/exceptions to see what doesn't work.

Hi
I haven't got any errors nor exceptions, feedback labels were ignored
and all messages went to feedback panel.
For the code see the site, it's back on-line.
http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket

-- 
Pozdrawiam / Best Regards
Rafal Krupinski

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


Re: wicket-6 User friendly form validation with Wicket (stuq)

Posted by James Selvakumar <ja...@mcruncher.com>.
Sorry,

Got most of the answers from the mailing list discussion here:
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4652978.html


On Mon, Nov 26, 2012 at 11:31 AM, James Selvakumar <ja...@mcruncher.com>wrote:

> Hi all,
>
> We have been using the examples given in the "FormsWithFlair" for a while
> and it has been working very well.
> However, we recently migrated from wicket 1.5.x to 6.3.0 and the code
> didn't compile because of some api changes.
>
> Here's the code that worked in 1.5.x
> <pre>
> public class ValidationMsgBehavior extends AbstractBehavior
> {
>     @Override
>     public void onRendered(Component c)
>     {
>         FormComponent fc = (FormComponent) c;
>         if (!fc.isValid()) {
>             String error;
>             if (fc.hasFeedbackMessage()) {
>                 error = fc.getFeedbackMessage().getMessage().toString();
>             } else {
>                 error = "Your input is invalid.";
>             }
>             fc.getResponse().write(
>                     "<div class=\"validationErrorMessage\">" + error +
> "</div>");
>         }
>     }
> }
> </pre>
>
> Am I right to say that I can replace AbstractBehavior with Behavior?
> But I'm not sure what will be the best way to handle the feedback messages
> related code.
> Is a call to "hasFeedbackMessage()" correct now or should we use a
> feedback collector here?
> "getFeedbackMessage()" has been removed so I have no choice but to use
> feedback collector to get it.
>
>
> On Tue, Nov 6, 2012 at 3:09 AM, Rafał Krupiński <r....@gmail.com>wrote:
>
>> On 05.11.2012 17:01, Martin Grigorov wrote:
>>
>>> See FormsWithFlair application and PDF at
>>> http://code.google.com/p/**londonwicket/downloads/list<http://code.google.com/p/londonwicket/downloads/list>
>>> It also shows how a behavior can be used for this.
>>>
>>
>> Thanks for the link, looks very promising.
>>
>>
>> Best Regards
>> Rafał Krupiński
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Thanks & regards
> James Selvakumar
>
>


-- 
Thanks & regards
James Selvakumar

Re: wicket-6 User friendly form validation with Wicket (stuq)

Posted by James Selvakumar <ja...@mcruncher.com>.
Hi all,

We have been using the examples given in the "FormsWithFlair" for a while
and it has been working very well.
However, we recently migrated from wicket 1.5.x to 6.3.0 and the code
didn't compile because of some api changes.

Here's the code that worked in 1.5.x
<pre>
public class ValidationMsgBehavior extends AbstractBehavior
{
    @Override
    public void onRendered(Component c)
    {
        FormComponent fc = (FormComponent) c;
        if (!fc.isValid()) {
            String error;
            if (fc.hasFeedbackMessage()) {
                error = fc.getFeedbackMessage().getMessage().toString();
            } else {
                error = "Your input is invalid.";
            }
            fc.getResponse().write(
                    "<div class=\"validationErrorMessage\">" + error +
"</div>");
        }
    }
}
</pre>

Am I right to say that I can replace AbstractBehavior with Behavior?
But I'm not sure what will be the best way to handle the feedback messages
related code.
Is a call to "hasFeedbackMessage()" correct now or should we use a feedback
collector here?
"getFeedbackMessage()" has been removed so I have no choice but to use
feedback collector to get it.


On Tue, Nov 6, 2012 at 3:09 AM, Rafał Krupiński <r....@gmail.com>wrote:

> On 05.11.2012 17:01, Martin Grigorov wrote:
>
>> See FormsWithFlair application and PDF at
>> http://code.google.com/p/**londonwicket/downloads/list<http://code.google.com/p/londonwicket/downloads/list>
>> It also shows how a behavior can be used for this.
>>
>
> Thanks for the link, looks very promising.
>
>
> Best Regards
> Rafał Krupiński
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar

Re: wicket-6 User friendly form validation with Wicket (stuq)

Posted by Rafał Krupiński <r....@gmail.com>.
On 05.11.2012 17:01, Martin Grigorov wrote:
> See FormsWithFlair application and PDF at
> http://code.google.com/p/londonwicket/downloads/list
> It also shows how a behavior can be used for this.

Thanks for the link, looks very promising.


Best Regards
Rafał Krupiński

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


Re: wicket-6 User friendly form validation with Wicket (stuq)

Posted by Martin Grigorov <mg...@apache.org>.
See FormsWithFlair application and PDF at
http://code.google.com/p/londonwicket/downloads/list
It also shows how a behavior can be used for this.


On Fri, Nov 2, 2012 at 9:58 PM, Rafał Krupiński <r....@gmail.com>wrote:

> On Mon, Oct 29, 2012 at 8:36 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> >> Anyway, I would like to have a label for each validated input field
> >> and put there any error messages related to that input.
> >> I haven't found any example other than that old article by Daan van
> >> Etten and that was for wicket 1.3.
> >> Daan's solution used his own FeedbackLabel class and filtered
> >> FeedbackPanel but it doesn't work with wicket 6.
> >
> > Please paste your code and compile errors/exceptions to see what doesn't
> work.
>
> Hi
> I haven't got any errors nor exceptions, feedback labels were ignored
> and all messages went to feedback panel.
> For the code see the site, it's back on-line.
> http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket
>
> --
> Pozdrawiam / Best Regards
> Rafal Krupinski
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


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