[html-formfu] How to write yml to confirm whether a record is in db?

Jason Kohles email at jasonkohles.com
Fri Jun 1 21:46:15 GMT 2007

On May 31, 2007, at 10:51 AM, chylli wrote:

> Hi Carl:
> sorry for my poor English.
>   I'm writing codes for register function. But I found no
> proper place to put my validate function.
> I just want to use HTML::FormFu to validate whether a user name has
> been in a table user using Catalyst::Controller::HTML::FormFu's attr
> FormConfig('register.yml'). But I dont know how to put the validator
> code to yml.
> Maybe I should put code to a custom module like
> MyApp::Validator::User. But I don't know how to get $c in that
> module. It seems like validator or constraint module only get two
> arguments, $self and $value.
> I try to change the form after load configure. But I found before I  
> got
> $from from $c->stash, that form has been processed.
> Can you add a new method to give user a form that has been populated
> by load_config_file but has not processed query? Then I can add code
> to use any local variables like $c, or finish other complex work.
> I should use other method like FormMethold, and write a
> load_form function to add my validate code to the form. But I think it
> is too inconvenient to load configure file.
If you are using DBIC, there is already a constraint module you can  
use: HTML::FormFu::Constraint::DBIC::Unique

Jason Kohles
email at jasonkohles.com
"A witty saying proves nothing."  -- Voltaire

More information about the HTML-FormFu mailing list