[Catalyst] Automatic structure creation from form data

Dami Laurent (PJ) laurent.dami at justice.ge.ch
Wed Jul 4 08:02:53 GMT 2007


> I was wondering if it possible to construct an HTML form such 
> that the back end automatically creates a hash (or an array) 
> based on the naming scheme.
> 
> For example...
> 
> <form>
>    <input name="items[0][name]" value="...">
>    <input name="items[0][description]" value="...">
>    <input name="items[1][name]" value="...">
>    <input name="items[1][description]" value="...">
>    ...
> </form>
> 

Have a look at CGI::Expand : it will translate your fields into a data
structure
with hashrefs and arrayrefs. The structure is given through dot
notation.
Works very well.

Regards, L. Dami



More information about the Catalyst mailing list