Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Example of complex constraint with HTML::FormValidator

by buckaduck (Chaplain)
on Mar 21, 2001 at 04:41 UTC ( [id://65921]=note: print w/replies, xml ) Need Help??


in reply to Example of complex constraint with HTML::FormValidator

In general, I'd try using something like:
constraints => { myfield => { constraint => sub { return (checkField() ? 1 : 0) }, params => [qw(myfield, otherparam1, otherparam2)], }, ... }
...where you can either use a subroutine checkField() or replace it with a short test right there in the anonymous subroutine.

There is an example in the documentation for the module, but it uses a built-in validation routine rather than an anonymous subroutine...

buckaduck

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://65921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found