3/10/2008

Click Framework + LiveValidation

Click controls provide JavaScript validation, but they are not easy to customize. Now I'm writing JavaScript validation framework for Click using LiveValidation. In the page class, ready the LivaValiator control like below:

Form form = new Form("form");
form.add(new TextField("name", true));
form.add(new PasswordField("password", true));
form.add(new Submit("login"));

addControl(new LivaValidator("validator", form));

In the page template, generates LiveValidation JavaScript code by the LiveValidator control:

<body>
  $form
  <script type="text/javascript">
    $validator
  </script>
</body>

We can also add customized validation rules by use of Validate.Custom.

3 件のコメント:

Bob Schellink さんのコメント...

Hi Naoki,

This seems interesting. Can one validate a Date with LiveValidation?

Client side Date validation is something lacking in Click currently.

kind regards

bob

Bob Schellink さんのコメント...

Hi Naoki,

Nice idea, does LiveValidation have support for Dates?

Client side Date validation is currently not available in Click.

kind regards

bob

Naoki Takezoe さんのコメント...

Hi Bob,

Sorry, I missed your comment.
LiveValidation does not support date validation. However we can add it.

I'll continue experiments in sandbox.