You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by harrypitt <Ha...@web.de> on 2008/10/02 09:33:43 UTC
Re: Pure client side validation
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
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)
- 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.
I have some additional questions about this topic:
- Are there any example implementations for such client side validations?
- There is also a Wicket-Stuff project "fvalidate": Has this project a
different concept?
- Is there a plan to integrate pure client side validation in the wicket
framework soon?
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pure client side validation
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
saw this lib:
http://yav.sourceforge.net/ maybe it fits better?
Nino Saturnino Martinez Vazquez Wael wrote:
> Ahh ok, I get you. So I guess IVisitor would be very good to use
> here.. Visit every component and put according js validation in there
> depending on which validator etc... Could be something I would look
> into at some point..
>
> Maybe the way would be to upgrade the fvalidate integration to current
> wicket version?
>
> harrypitt wrote:
>> Ok, my question was not clear enough.
>>
>> With "Pure client side validation" i mean a javascript validation which
>> needs no ajax requests. Of course there should be always a server side
>> validation and the whole default Wicket form-handling AFTER the
>> submit. It
>> would be really stupid to just rely on javascript validation.
>>
>> Nino.Martinez wrote:
>>
>>> I wont be doing pure client side validation, as it is unsafe..
>>>
>>>
>>
>>
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pure client side validation
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Ahh ok, I get you. So I guess IVisitor would be very good to use here..
Visit every component and put according js validation in there depending
on which validator etc... Could be something I would look into at some
point..
Maybe the way would be to upgrade the fvalidate integration to current
wicket version?
harrypitt wrote:
> Ok, my question was not clear enough.
>
> With "Pure client side validation" i mean a javascript validation which
> needs no ajax requests. Of course there should be always a server side
> validation and the whole default Wicket form-handling AFTER the submit. It
> would be really stupid to just rely on javascript validation.
>
>
> Nino.Martinez wrote:
>
>> I wont be doing pure client side validation, as it is unsafe..
>>
>>
>
>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pure client side validation
Posted by harrypitt <Ha...@web.de>.
Ok, my question was not clear enough.
With "Pure client side validation" i mean a javascript validation which
needs no ajax requests. Of course there should be always a server side
validation and the whole default Wicket form-handling AFTER the submit. It
would be really stupid to just rely on javascript validation.
Nino.Martinez wrote:
>
> I wont be doing pure client side validation, as it is unsafe..
>
--
View this message in context: http://www.nabble.com/Pure-client-side-validation-tp19737383p19777140.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pure client side validation
Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
harrypitt 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
>
> 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)
> - 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.
>
> I have some additional questions about this topic:
> - Are there any example implementations for such client side validations?
> - There is also a Wicket-Stuff project "fvalidate": Has this project a
> different concept?
> - Is there a plan to integrate pure client side validation in the wicket
> framework soon?
I wont be doing pure client side validation, as it is unsafe..
>
> 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
>>
>>
>>
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pure client side validation
Posted by Igor Vaynberg <ig...@gmail.com>.
On Thu, Oct 2, 2008 at 12:33 AM, harrypitt <Ha...@web.de> 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: 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