[html-formfu] Callbacks

Carl Franks fireartist at gmail.com
Mon Jul 5 12:55:46 GMT 2010


Hi,

I'd recommend writing a custom constraint class, rather than using Callback.
It just needs to inherit from HTML::FormFu::Constraint and have a sub
named 'constrain_value' which will receive the parameters ( $self,
$value, $params).
You can then access the Catalyst context via $self->form->stash->{context}

It can also define a 'constrain_values' sub to override how multiple
values are handled, or override 'process' to take complete control -
see the source of HTML::FormFu::Constraint for details.

Carl


On 2 July 2010 09:27, Benjamin Martin <benjamin at opusvl.com> wrote:
> Hello,
>
> In my catalyst app I have a method that is used for a Callback constraint.
> In my Root.pm controller use a session and log in a user the usual way.
>
>
>        package MyApp::Controller::ControllerA;
>        ...
>        sub formfu_callback_checka
>        {
>                # need to validate using something in session?..
>        }
>
>
> My question is, what is the best way to get hold of the session/user data
> from within my callback method?
>
> thanks for any help, apologizes if this gets asked all the time,
> -Ben
>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>



More information about the HTML-FormFu mailing list