[html-formfu] Populate form using a complex hashref?

Moritz Onken onken at houseofdesign.de
Fri Feb 27 14:29:53 GMT 2009


Am 27.02.2009 um 15:08 schrieb Carl Franks:

> 2009/2/27 Moritz Onken <onken at houseofdesign.de>:
>>
>> Am 27.02.2009 um 12:28 schrieb Carl Franks:
>>
>>> 2009/2/27 Moritz Onken <onken at houseofdesign.de>:
>>>>
>>>> Am 27.02.2009 um 12:10 schrieb Carl Franks:
>>>>
>>>>> 2009/2/27 Moritz Onken <onken at houseofdesign.de>:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> is it possible to populate a form with data using a complex  
>>>>>> hashref in
>>>>>> ->process()?
>>>>>>
>>>>>> I'd like to fill a form with data like this:
>>>>>>
>>>>>> {user => "test", addresses => [{address => "somwhere"},{address  
>>>>>> =>
>>>>>> "somewhere else"}]}
>>>>>>
>>>>>> where "addresses" is a repeatable block.
>>>>>
>>>>> No.
>>>>> If this were added, it should be to default_values(), not  
>>>>> process().
>>>>> Passing a hash-ref to process() is just an easy way to fake a  
>>>>> query
>>>>> object.
>>>>>
>>>>> Carl
>>>>
>>>>
>>>> Ok, so I'll try to create a HTML::FormFu::Model::HashRef.
>>>
>>> Why not just extend HTML::FormFu::default_values() to handle it?
>>> As it looks like you'd just be needing the default_values() side of
>>> things, and not the update/create methods.
>>
>> sounds reasonable.
>> But I thought it might also be helpful ich we have such a update/ 
>> create
>> method which creates such a hashref.
>
> Sure, in that case, a model would be appropriate.
> Out of interest, is this for ExtJS or something else?

Yes it's ExtJS stuff. I need hashrefs to feed a JSON encoder. I'm not  
sure yet how it should be implemented. But I think this is a good start.

I attached a patch which adds the functionality to default_values().  
Test t/form/default_values.t modified.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_values.patch
Type: application/octet-stream
Size: 5540 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090227/87658a3f/default_values.obj
-------------- next part --------------



More information about the HTML-FormFu mailing list