You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cliff Zhao <zh...@gmail.com> on 2006/02/05 08:29:48 UTC

How to do a form level client side validation?

I see that all the validators are on the form fields. But before submit, I
still need to cross-check form fields (the form fields have special
relationships, for example, four fields together need to meet a certain
rule) although the individual fields pass validation. On the server side, I
can handle it in the submit listener. How can I do it on the client side?

Thanks.

Re: How to do a form level client side validation?

Posted by Vincent <vi...@gmail.com>.
Hi Cliff,

In the class BaseValidator there is two methods, how this could help.

isClientScriptingEnabled

public boolean isClientScriptingEnabled()

    Returns true if client scripting is enabled. Some validators are
capable of generating client-side scripting to perform validation when
the form is submitted. By default, this flag is false and subclasses
should check it (in renderValidatorContribution(IFormComponent,
IMarkupWriter, IRequestCycle)) before generating client side script.

    Since:
        2.2

setClientScriptingEnabled

public void setClientScriptingEnabled(boolean clientScriptingEnabled)

On 2/5/06, Cliff Zhao <zh...@gmail.com> wrote:
> I see that all the validators are on the form fields. But before submit, I
> still need to cross-check form fields (the form fields have special
> relationships, for example, four fields together need to meet a certain
> rule) although the individual fields pass validation. On the server side, I
> can handle it in the submit listener. How can I do it on the client side?
>
> Thanks.
>
>