On Mon, Feb 2, 2009 at 7:59 PM, Jason Gottshall <[email protected]> wrote: > Zbigniew Lukasiak wrote: >> >> Maybe I am just being lazy now - but before I start digging too deep - >> did you take into accout that some forms require loading stuff from >> the DB? It can happen in to cases: >> >> 1) loading SELECT choices lists - this one is easy - because it can be >> done at initialisation as it does not depend on th request. >> >> 2) loading related forms for one to many relations - where you don't >> know how many related forms you need until you have the main object - >> i.e. until request time. See Rose::HTML::Form::Repeatable. > > Yes, I'm actually thinking of doing > > my $form = $class->new( app => $c ); > > so that the form can access model-related stuff as necessary. (This is safe > because RHTMLO automatically weakens any value passed to ->app). Would > something like that address your cases?
Hmm - I thought you mentioned something about caching the form objects between requests? Passing $c to the creator means you create the forms on per request basis. If you like the caching idea - then what would be needed is a kind of two phase initialisation. First you create a prototype - and then you add the necessary repeatable sub-forms on per request basis to it (of course this is only needed if you use repeatable sub-forms). Cheers, Zbigniew http://brudnopis.blogspot.com/ http://perlalchemy.blogspot.com/ _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
