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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pure client side validation
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pure client side validation
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pure client side validation
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]
Re: Pure client side validation
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pure client side validation
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pure client side validation
Hi Harry, Well, it should be possible to create a Behavior taking care of stuff this... e.g. like textField.add(new ClientSideRequiredValidationBehavior(myErrorLabel)); ClientSideRequiredValidationBehavior should override onComponentTag then to add onchange/onblur javascript code to your input field which updates myErrorLabel in case of error (or does something else). You would merely be adding javascript behavior to your input tag then, which would of course not act like normal wicket validators. And you would have to implement validation in javascript manually again, which would cause some redundancy, because there should definitely be server side validation on form submission as you cannot trust the data coming in from a client. Hope this helps... Cheers :) harrypitt wrote: Hi, The company I'm working for is evaluating different java-web-frameworks and it seems that Wicket or JSF will be the winner (To be honest, my personal opinion is that Wicket is the far better choice). In this evaluation i have to make sure if the framework supports pure (java script) client side validation. As far as i know Wicket only supports client side validation with ajax requests. This solution is not satisfying for us, because we want to use the framework to create huge forms which are used by many people. And we think it would be a hard job for our servers to process all that requests. My question: Is it possible to create light weight validators (like required validator) that are working with java script and act like normal wicket validators: textField.add(new ClientSideRequiredValidator()); I know that this topic was discussed in the mailing list many times, but i haven't found a real solution for this. Harry -- View this message in context: http://www.nabble.com/Pure-client-side-validation-tp19737383p19740821.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]
Re: Pure client side validation
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 On Tue, Sep 30, 2008 at 12:28 AM, harrypitt [EMAIL PROTECTED] wrote: Hi, The company I'm working for is evaluating different java-web-frameworks and it seems that Wicket or JSF will be the winner (To be honest, my personal opinion is that Wicket is the far better choice). In this evaluation i have to make sure if the framework supports pure (java script) client side validation. As far as i know Wicket only supports client side validation with ajax requests. This solution is not satisfying for us, because we want to use the framework to create huge forms which are used by many people. And we think it would be a hard job for our servers to process all that requests. My question: Is it possible to create light weight validators (like required validator) that are working with java script and act like normal wicket validators: textField.add(new ClientSideRequiredValidator()); I know that this topic was discussed in the mailing list many times, but i haven't found a real solution for this. Harry -- View this message in context: http://www.nabble.com/Pure-client-side-validation-tp19737383p19737383.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]