http://www.perlmonks.org?node_id=79976

Hello! I've been using HTML::FormValidator on a regular basis now, and I really like it's basic function as a module. I wrote up an example of how I use it here.

Now I've realized there are a number of ways it could be improved. Since the current maintainer has been initially unresponsive to my queries, I plan to go ahead with creating a significant patch to the module. I'd like to ask ya'll monks for feedback on the following module design changes:

update 5/13/01: clarified note about CPAN, retracted idea about using hashes directly in constructor.

Replies are listed 'Best First'.
Re: proposal for HTML::FormValidator upgrade
by TStanley (Canon) on May 13, 2001 at 04:18 UTC
    As an idea, why don't you also submit the article that you wrote to the Reviews section, and share
    the wealth with the rest of your fellow monks?

    TStanley
    In the end, there can be only one!
      Alright, my review of HTML::FormValidator has now been posted.
Re: proposal for HTML::FormValidator upgrade
by DrZaius (Monk) on May 13, 2001 at 12:00 UTC
    * Easier access from CPAN

    Why is this so bad? Isn't this why we have CPAN in the first place? I like it when modules use other modules -- that means less redundancy and less code.

      HTML::FormValidator has false dependencies-- you don't need any of the other modules that get downloaded when you try to grab just HTML::FormValidator.

      -mark

HTML::FormValidator changes available in Data::FormValidator
by markjugg (Curate) on Jun 21, 2001 at 03:07 UTC
Invalid field error messages
by Anonymous Monk on May 14, 2001 at 00:39 UTC
    I like most of the ideas. It would be useful to be able to handle "pretty" values of field names, and even better yet, error messages when a field is invalid (e.g. email => "Your e-mail address is invalid", or password => "The passwords that you entered do not match)" I'd also like to see a stand-alone CPAN distribution. I currently include it in Apache::PageKit, but I would unbundle it if there was a good standalone dist.
patch to HTML::FormValidator available
by markjugg (Curate) on May 16, 2001 at 21:04 UTC

    I have now prepared a patch to the code and POD of HTML::FormValidator with the following changes. I would appreciate your review and feedback of these changes. The patched module can be downloaded here:

    http://mark.stosberg.com/tech/perl/form-validation/FormValidator.pm

    Changes:

    • Several updates to the syntax and grammar of the POD
    • Added code and documentation for a procedural interface
    • Added code and docs to allow specifying single item anon. arrays as regular strings
    • Added initial code to support better handling of dynamic form validation. This included added two new routines: constraint_suffix_map and constraint_prefix_map. This allows you map all fields that have a common ending to automatically have a particular constraint applied (for example, validating all fields ending in _zip as zipcodes)
    • added option for "dependency groups"-- when any field in the group is field in, they all become required.

    I have tested all my changes, but I would appreciate your reality checks as well.

    I have a few more features I'd like to add to round out support for dynamic form field generation, but I thought it would be good to send this version out for review already. Here are the features I want to add:

    require_suffixes
    optional_suffixes
    require_prefixes
    optional_prefixes
    require_regex
    optional_regex

    The basic idea to specific whether some fields are required or optional based on there suffix, prefix, or a regular expression.

    -mark