JavaScript::DataFormValidator - JavaScript form validation from a Perl
    Data::FormValidator profile

    This module helps with setting up a JavaScript validation for a form
    using Data.FormValidator, a JavaScript port of Data::FormValidator. A
    key feature of this system is that it allows you to use the *exact same*
    validation profile for both Perl and JavaScript validation.

    You should read the docs for the JavaScript implementation for some

    Here's an example with HTML::Template syntax:

      <script type="text/javascript" src="../JSAN/Data/FormValidator.js"></script>

      <!-- tmpl_var dfv_profile -->

      <form action="/foo"  <tmpl_var js_dfv_onsubmit > >
      <!-- ... ->

    And then back in your perl code...

     use JavaScript::DataFormValidator;
     my $t = HTML::Template->new_file('foo.html');  
        dfv_profile => js_dfv_profile( 'my_form' => {
                required => [qw/email first_name/],
                optional => 'last_name',
                constraints => {
                    email => 'email',
        js_dfv_onsubmit => js_dfv_onsubmit('my_form');

    The Data.FormValidator JavaScript file must be copied to your server so
    that you can call it. Download the latest version from here:

  js_dfv_profile( $profile_name => \%profile_hash );
    $dfv_profile_in_js = js_dfv_profile( $profile_name => \%profile_hash );

    Takes a named Data::FormValidator profile in Perl, and returns a
    representation of it in JavaScript, for use with the Data.FormValidator
    JavaScript module.

    Hopefully, it's done. It's very simple code.

    However, the API may break and change in the first weeks after the the
    release as I get feedback. I'll plan to at least make a new release to
    remove this notice once things seem stable.

     $onsubmit_code = js_dfv_onsubmit($profile_name);

    Returns the Javascript snippet to put in your <form> tag to call the
    basic "check_and_report()" JavaScript validation function.

    This module is mostly released as a demonstration of how to integrate
    with the Data.FormValidator JavaScript project. For anything more
    complicated, it will probably be easier to use this source code as
    starting point for a custom solution.

    Mark Stosberg, "<mark at>"

    Please report any bugs or feature requests to
    "bug-cgi-application-plugin-javascript-formvalidator at", or
    through the web interface at
    ator>. I will be notified, and then you'll automatically be notified of
    progress on your bug as I make changes.

    * CPAN Page

    * RT: CPAN's request tracker

    This uses Data::JavaScript::Anon for the heavy lifting.

    Copyright 2005 Mark Stosberg, all rights reserved.

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.