[html-formfu] Callbacks

Benjamin Martin benjamin at opusvl.com
Mon Jul 5 13:00:23 GMT 2010


Hi Carl,

Thanks for the tip.. that sounds like an excellent, clean tidy way to 
tackle my problem.

When I have got a solution ready I'll put some POD on here for the 
CookBook if you want.

cheers,
-Ben


On 05/07/10 13:55, Carl Franks wrote:
> 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
>>
>>      
> _______________________________________________
> 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