First thing that I have to notice:
ClientAndServerExactLengthValidatingBehavior is an awful class name.
LengthValidation would be enough.

The other thing: I wouldn't use clientside validation when it
validates on submit only. It should validate non-empty fields on blur,
and fields already marked as invalid on keyup. Without that there
really isn't much of a point in using clientside validation at all.

I'll try to look at your actual code, though some examples would help a lot!

Jörn

On Sun, Oct 5, 2008 at 7:33 AM, Jeremy Thomerson
<[EMAIL PROTECTED]> wrote:
> Okay, I was able to commit what I had already started on.  This is only a
> few hours work, so it is nowhere near complete.  However, I have the basis
> for the framework, and a replica of all the StringValidator validation
> done.
>
> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-client-and-server-validation/
>
> Here are the basic features:
>
>   - By simply replacing formcomponent.add(StringValidator.exactLength(4))
>   with add(new ClientAndServerExactLengthValidatingBehavior(form, 4)), it will
>   do the client side validation and add the server side IValidator for you.
>   - It is internationalized because it uses all of the same resource keys /
>   messages that the standard Wicket validators use.
>   - It can insert feedback messages onto the page in a feedback panel or
>   other WebMarkupContainer by calling feedbackpanel.add(new
>   ClientAndServerValidatingFeedbackBehavior(form)) - this will make it use the
>   same appearance that the normal feedback panel would generate.
>
> I'm sure there is quite a bit of stuff that can be cleaned up, especially in
> the JS code.  For instance, I'm using document.getElementById quite a bit,
> but I'm not sure if there are some browsers that may not support that.  I
> need to look because I can't remember.  Anyway, feedback is welcome!
>
> NOTE: I had started it within another project and was testing it there.  I
> have not had time to test it again after I moved it to its own project.
> Since all I did was move it, add the license info and rename the packages,
> it should still work, but you know how that goes.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> On Sat, Oct 4, 2008 at 9:39 AM, Jeremy Thomerson
> <[EMAIL PROTECTED]>wrote:
>
>> Basically, where you would normally call:
>> Formcomponent.add(IValidator),
>> You could now add a behavior.  In my behavior, on bind I add the
>> server-side equivalent validator.  Then in renderHead, I add some onLoad JS
>> that adds the component to a JS array of components to be validated on form
>> submit.
>>
>> Let me get a little more of the basic started, and then I would REALLY
>> welcome the help!  Maybe tomorrow night or Monday I can get a wicketstuff
>> project started for it...
>>
>> The help will be great - my JS fu is rusty!
>>
>> Jeremy Thomerson
>> http://www.wickettraining.com
>> -- sent from a wireless device
>>
>>
>> -----Original Message-----
>> From:  Jörn Zaefferer  =F6rn_Zaefferer _ <[EMAIL PROTECTED]>
>> Sent: Saturday, October 04, 2008 5:50 AM
>> To: users@wicket.apache.org
>> Subject: Re: Client side validation behaviors - already started?
>>
>> What approach for client-side validation are you looking for? I may be
>> able to help with that.
>>
>> Jörn
>>
>> On Fri, Oct 3, 2008 at 5:50 AM, Jeremy Thomerson
>> <[EMAIL PROTECTED]> wrote:
>> > I've been thinking of trying to create some behaviors that combine the
>> > standard server-side validation with client-side validation.  I just
>> wanted
>> > to check to see if anyone knew of something like this already started.  I
>> > don't want to duplicate work already done.
>> >
>> > Thanks,
>> >
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>>
>

Reply via email to