I have written a wrapper API around Data::FormValidator and it is
getting close to being sharable.
The module basically provides an object oriented API to add form
elements dynamically, and wraps the output of a validator object from
your module.
A sample of the code to make a form looks like this:
$form-add_element( category_id, { required = 1 } );
$form-add_element( name, { required = 1, errmsg = 'Please fill
in a name for this category' } );
$form-add_element( description, {} );
$form-add_element( help_text, {} );
$form-add_element( sort_position, { required = 1, constraints
= qr/^\d+$/, invmsg = The sort position has to be a number. } );
$form-add_element( visible, { required = 0, value = 0,
constraints = qr/^\d+$/, invmsg = The sort position has to be a
number. } );
then, each element can be accessed like this:
$form-param(category_id); # the current value
$form-message(category_id); # the error message or invalid message,
depending on if
# something is missing or invalid.
Basically, this will construct a profile for D::FV to use, but still
allow easy access to the objects in the form in another part of an
application.
I am looking for naming ideas. I had initially thought of
Data::FormValidator::API, but it lacks a certain pizazz. ;)
Any thoughts? Any interest?
And hello! This is my first post to the group.
Thanks!
-jason scott gessner
[EMAIL PROTECTED]