[html-formfu] A generic way to fetch values from the stash?

Carl Franks fireartist at gmail.com
Wed Mar 26 13:23:50 GMT 2008


On 26/03/2008, Andreas Marienborg <omega at palle.net> wrote:
>
>  On Mar 26, 2008, at 1:46 PM, Carl Franks wrote:
>
>  > On 26/03/2008, Andreas Marienborg <omega at palle.net> wrote:
>  >> Currently, I use the Catalyst-plugin to stash the language the app is
>  >> deployed as in the formfu-stash. I would like to use this as the
>  >> default-value for the country dropdown, and as such came the idea
>  >> of a
>  >> generic way to use stash-values. Not sure how to do it cleanly
>  >> though,
>  >> so its more a random thought at the moment
>  >>
>  >>
>  >> any ideas? Can anyone else think of useful uses for such a feature?
>  >
>  > Can't really think of a generic way - but we could give all fields a
>  > default_from_stash($key) method?
>  > kinda like Model-DBIC's condition_from_stash()
>
>
> Yeah, I was thinking about that, but then one might want
>  attribute_from_stash, value_from_stash etc :p
>
>  I guess default_from_stash would solve my imidiate problem, so I guess
>  I might just implement that, if thats ok?

hmm, I suppose you could make it more like condition_from_stash(), and
have it accept a hashref:

    method_from_stash({ default => $key })

although that wouldn't work for general attributes() that don't have a
dedicated method.

Carl



More information about the HTML-FormFu mailing list