[html-formfu] Processing a query

Benjamin Martin benmartin at venda.com
Wed Jun 8 07:24:54 GMT 2011


Quick update on this...

I ran into problems doing my own QueryType module. (I am sure with abit 
more time, determination and understanding it could be addressed). For 
now I managed to work around the problem by using the query_type of 
'Catalyst' and constructing my own object to be passed to ->process

   $formfu->query_type('Catalyst);
   my $form_submission = MyApp::FormSubmission->new(
     formfu   =>  $formfu,
     formdata =>  sclar params,
     uploads   =>  request->uploads
   );
   $formfu->process( $form_submission );


This is a pretty hacky, as the FormSubmission object just provides the 
same interface the Catalyst query type uses to process submissions and 
so it works. (it was quick, easy and hacky because Catalyst and Dancer 
upload objects have the same interface)

Anyway, when I get round to it I think I will try to do a 
::QueryType::Dancer for FormFu, but for now this hack works.


On 07/06/11 10:45, Benjamin Martin wrote:
> thanks Peter.
>
> I thought that might be the answer, better get my hacking hat on. :)
>
>
>
> On 07/06/11 10:38, Peter Shangov wrote:
>> Hi Benjamin,
>>
>> I think the right way to approach this problem would be to write a 
>> HTML::FormFu::QueryType::Dancer class. The HTML::FormFu::QueryType 
>> namespace exists specifically to manage the different ways frameworks 
>> handle file uploads. Then you will only have to do:
>>
>>    $params = params();
>>    $formfu->query_type( 'Dancer' );
>>    $formfu->process( $params );
>>
>>
>> Cheers,
>>
>> -- 
>> Peter
>>
>>
>> ----- Original Message -----
>>> From: Benjamin Martin<benmartin at venda.com>
>>> To: html-formfu at lists.scsys.co.uk
>>> Cc:
>>> Sent: Tuesday, 7 June 2011, 11:18
>>> Subject: [html-formfu] Processing a query
>>>
>>> Hello All,
>>>
>>> I am using formfu with Dancer, something like so:
>>>
>>>    $params = params();
>>>    $formfu->process( $params );
>>>
>>> $params is a simple hashref of form name/values.
>>>
>>> I now want to process file uploads.
>>>
>>> Is there a way to include uploads in the $params hash?
>>>
>>> Will I have to construct something that simulates a CGI object and 
>>> pass that to
>>> the $formfu->query( ... )? ... if so, are there any pointers/example 
>>> you can
>>> provide.
>>>
>>> Many thanks for any pointers/advice,
>>>
>>> -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
>>
>
>
> _______________________________________________
> 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