On Thu, Oct 2, 2008 at 12:33 AM, harrypitt <[EMAIL PROTECTED]> wrote:
>
> Thanks for that solution,
>
> To summarize that:
> - Extend a normal Validator
> - Add the IValidatorAddListener Interface
> - Implement the onAdded method
> - In this method: add a Custom Behavior to the component
> - In the custom Behavior: Integrate the js like described here:
> http://cwiki.apache.org/WICKET/creating-a-behavior-to-use-a-javascript-library.html

dont know about your last point. it should just output some javascript
that does the validation test and integrates the results into some
javascript error reporting framework you have - simplest of which
would be alert('field foo does not validate');

> But I think there are two weak points in that implementation (correct me if
> I'm wrong):
> - I have to rewrite the whole logic für the validator in Javascript (ok,
> that's no surprise)

this is what ajax helps you not to do, but you said you dont want that
so this is the price to pay.

> - In case the validator gets an error, I have to do an ajax request to
> trigger the wicket feedback message system (a js only feedback would be a
> problem, because js validation would produce duplicate messages after a
> submit with errors). So in general I only avoid the ajax request if the js
> validator finds no errors.

dont really follow you. if there is a validation error you do not
submit the form...your validators can output something like this:

addevent(form, 'onsubmit', function() { if (!test()) { return false; }});

this way if validation fails the onsubmit returns false and the form
is not submitted. addevent() depends on your favorite javascript
library.

> I have some additional questions about this topic:
> - Are there any example implementations for such client side validations?

dont think so, maybe you can create one

> - There is also a Wicket-Stuff project "fvalidate": Has this project a
> different concept?

i think that project is defunct, fvalidate has been for a while at least.

> - Is there a plan to integrate pure client side validation in the wicket
> framework soon?

no, not "soon". it is something we can consider for 1.5 but first we
need to end of life 1.3 and release 1.4.

-igor

>
> Harry
>
>
> igor.vaynberg wrote:
>>
>> it is possible, just not there out of the box. can look like something
>> like this
>>
>> class rangejsvalidator extends rangevalidator implements
>> IValidatorAddListener {
>>   void onAdded(Component component) { // add some behavior to output
>> javascript validation }
>> }
>>
>> -igor
>>
>>
> --
> View this message in context: 
> http://www.nabble.com/Pure-client-side-validation-tp19737383p19774599.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to