[html-formfu] adding constraints dynamically

Steve Rippl rippls at woodlandschools.org
Sat Aug 15 03:47:06 GMT 2009


Hi,

I have a Catalyst app with large dynamic forms, most of which gets built 
programatically with things like

...
my $element = $form->element( Text => $form_id );
$element->name($form_id);
$element->id($form_id);
...
$element->add_attributes( size => $size, maxlength => $size );
...
etc etc...

Now, how can I add constraints in this way?  $element->constraints( 
'Range' => ( min => $min, max => $max ) ); doesn't throw any errors, but 
doesn't work either!  How can I add a range constraint as above, and 
also how could I add a simple regex constraint like /[A-E]/ ?

Lastly, is it possible to and/or constraints?  i.e. "value in range 1-5 
|| value in range 10-20" etc.

Many thanks,
Steve

-- 
Steve Rippl
Technology Director
Woodland School District
360 225 9451 x326




More information about the HTML-FormFu mailing list