[Catalyst] Automatic structure creation from form data

Andrew Hayward andrew at takkle.com
Tue Jul 3 19:19:52 GMT 2007


I'm relatively new to this Catalyst malarkey, so you'll have to bear 
with me for a minute.

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>

...giving...

$c->request->parameters->{items}->[0]->{name}
...etc (which itself is probably incorrect!)


If I'm barking up the wrong tree, or just plain barking, then please 
excuse me. I know it can be done in other server-side languages (yes, 
I'm more used to PHP), and I figured it might be something that other 
people have tried in the past.


Thanks,

- Andrew



More information about the Catalyst mailing list