Re: Server and client side validation
Martin, Thank you it was even easier than I though. /// starts parsley for this form (or the root form) final Form form = (Form) component; varResponse.render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').parsley();", form.getRootForm() .getMarkupId(;/ Regards, Gabriel -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658795.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Server and client side validation
Hi Gabriel, On Tue, May 14, 2013 at 12:43 AM, Gabriel Landon wrote: > Hi Martin, > > It does work with the following code: > /return $('#%s').closest('form').parsley( 'validate' );/ > > Thank you very much. > > To find out whether the form is in a ModalWindow or not, I've used the > following code: > /@Override > public void renderHead(final IHeaderResponse varResponse) { > super.renderHead(varResponse); > // starts parsley for this form > if (this.findParent(ModalWindow.class) == null) { > I think you should look for the root form instead of a ModalWindow. You can have nested forms in your app without ModalWindow around. See org.apache.wicket.markup.html.form.Form#findForm and org.apache.wicket.markup.html.form.Form#getRootForm > varResponse > > .render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').parsley();", > this.getMarkupId(; > } else { > > > varResponse.render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').closest('form').parsley();", > this.getMarkupId(; > } > }/ > > Is there a better way to do that, or is it OK? > > Regards, > > Gabriel. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658773.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Martin Grigorov Wicket Training & Consulting http://jWeekend.com <http://jweekend.com/>
Re: Server and client side validation
Hi Martin, It does work with the following code: /return $('#%s').closest('form').parsley( 'validate' );/ Thank you very much. To find out whether the form is in a ModalWindow or not, I've used the following code: /@Override public void renderHead(final IHeaderResponse varResponse) { super.renderHead(varResponse); // starts parsley for this form if (this.findParent(ModalWindow.class) == null) { varResponse .render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').parsley();", this.getMarkupId(; } else { varResponse.render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').closest('form').parsley();", this.getMarkupId(; } }/ Is there a better way to do that, or is it OK? Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658773.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Server and client side validation
Hi Gabriel, I guess ParsleyJS checks that the parameter for #validate() is a 'form' element. Since this is a nested form Wicket transforms it to a DIV, because otherwise the HTML will not be valid. Wicket knows how to deal with submitting nested forms but you have to do some manual work for Parsley - Parsley.validate($('#nestedFormId').closest('form')[0]), or something like this. On Wed, May 8, 2013 at 8:02 AM, Cedric Gatay wrote: > Hi, > I've not yet tried to plug it inside a modal window. But I see no reason > for it to fail. > Le 7 mai 2013 20:15, "Gabriel Landon" a écrit : > > > Hi Cedric, > > > > Yes I've seen what you have done. > > Did you manage to make it works with forms in ModalWindow? > > > > Regards, > > > > Gabriel. > > > > > > > > > > -- > > View this message in context: > > > http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658631.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > -- Martin Grigorov Wicket Training & Consulting http://jWeekend.com <http://jweekend.com/>
Re: Server and client side validation
Hi, I've not yet tried to plug it inside a modal window. But I see no reason for it to fail. Le 7 mai 2013 20:15, "Gabriel Landon" a écrit : > Hi Cedric, > > Yes I've seen what you have done. > Did you manage to make it works with forms in ModalWindow? > > Regards, > > Gabriel. > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658631.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Server and client side validation
Hi Cedric, Yes I've seen what you have done. Did you manage to make it works with forms in ModalWindow? Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658631.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Server and client side validation
Hi Gabriel, the spin-off from Martin's blog post is available on Maven Central (via Sonatype OSS services). It depends on JSR303 though. Regards, __ Cedric Gatay (@Cedric_Gatay <http://twitter.com/Cedric_Gatay>) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Tue, May 7, 2013 at 2:37 AM, Gabriel Landon wrote: > Martin, > > I've create a ParsleyRangeValidator and a ParsleyLengthValidator very > easily > thanks to your code. > I've also create ParsleyForm that initializes Parsley in the RenderHead and > a ParsleyAjaxButton that validates Parsley on submit. > > I only have one problem with forms in a ModalWindow. As the form tag is > replace with a div tag, Parsley doesn't seems to work in this case. > Do you have an idea on how to fix that? > > Regards, > > Gabriel. > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658602.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Server and client side validation
Martin, I've create a ParsleyRangeValidator and a ParsleyLengthValidator very easily thanks to your code. I've also create ParsleyForm that initializes Parsley in the RenderHead and a ParsleyAjaxButton that validates Parsley on submit. I only have one problem with forms in a ModalWindow. As the form tag is replace with a div tag, Parsley doesn't seems to work in this case. Do you have an idea on how to fix that? Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658602.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Server and client side validation
Martin, That's a great project! That's exactly what I've been waiting for! It would be very nice to have it in wicketstuff so we could upload it with maven and maybe extend it. Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658601.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Server and client side validation
Thanks for sharing, Cedric! Well done! On Tue, Apr 30, 2013 at 9:19 AM, Cedric Gatay wrote: > Hi, > > Your blog post helped me write my first version of the integration between > JSR303 (bean-validation) and client side validation using parsley.js. You > can find the current work on this Github repository: > https://github.com/code-troopers/wicket-jsr303-parsley > > Regards, > > __ > Cedric Gatay (@Cedric_Gatay <http://twitter.com/Cedric_Gatay>) > http://code-troopers.com | http://www.bloggure.info | > http://cedric.gatay.fr > > > On Wed, Apr 24, 2013 at 7:23 PM, Cedric Gatay wrote: > > > Thanks Martin, > > I was just wondering how I could do that. Nice library and nice > > integration with Wicket. > > > > Regards > > Le 24 avr. 2013 18:07, "Martin Grigorov" a écrit > : > > > > Hi, > >> > >> I just posted a new article at > >> > http://wicketinaction.com/2013/04/server-and-client-side-validation/about > >> integrating Wicket with client side validation library. > >> > >> Enjoy! > >> > >> -- > >> Martin Grigorov > >> jWeekend > >> Training, Consulting, Development > >> http://jWeekend.com <http://jweekend.com/> > >> > > > -- Martin Grigorov Wicket Training & Consulting http://jWeekend.com <http://jweekend.com/>
Re: Server and client side validation
Hi, Your blog post helped me write my first version of the integration between JSR303 (bean-validation) and client side validation using parsley.js. You can find the current work on this Github repository: https://github.com/code-troopers/wicket-jsr303-parsley Regards, __ Cedric Gatay (@Cedric_Gatay <http://twitter.com/Cedric_Gatay>) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Wed, Apr 24, 2013 at 7:23 PM, Cedric Gatay wrote: > Thanks Martin, > I was just wondering how I could do that. Nice library and nice > integration with Wicket. > > Regards > Le 24 avr. 2013 18:07, "Martin Grigorov" a écrit : > > Hi, >> >> I just posted a new article at >> http://wicketinaction.com/2013/04/server-and-client-side-validation/about >> integrating Wicket with client side validation library. >> >> Enjoy! >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com <http://jweekend.com/> >> >
Re: Server and client side validation
Thanks Martin, I was just wondering how I could do that. Nice library and nice integration with Wicket. Regards Le 24 avr. 2013 18:07, "Martin Grigorov" a écrit : > Hi, > > I just posted a new article at > http://wicketinaction.com/2013/04/server-and-client-side-validation/ about > integrating Wicket with client side validation library. > > Enjoy! > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com <http://jweekend.com/> >
Server and client side validation
Hi, I just posted a new article at http://wicketinaction.com/2013/04/server-and-client-side-validation/ about integrating Wicket with client side validation library. Enjoy! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>