Hi Gabriel,

On Tue, May 14, 2013 at 12:43 AM, Gabriel Landon <glan...@piti.pf> 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/>

Reply via email to