[Html-widget] FormFu: validating complex structures
Jonas Alves
jonas.alves at gmail.com
Fri Apr 27 16:53:59 GMT 2007
Hi all,
I would like to use FormFu to validate a complex structure. It may
come from a JSON file or from a form expanded with CGI::Expand.
How hard would be to patch HTML::FormFu to process something like this?
I thought that container fields could act as a container to a sub-hash.
Something like this:
elements:
- type: text
name: user
- type: text
name: email
- type: fieldset
name: address
- type: text
name: street
- type: text
name: code
Would validate a structure like:
{
user => 'John',
email => 'john at mail.com',
address => {
street => 'xxxxxxx',
code => 1000,
}
}
And would generate a form with dotted name convention like:
<form>
<input name="user">
<input name="email">
<fieldset>
<input name="address.street">
<input name="address.code">
</fieldset>
</form>
That could be translated in a complex structure with CGI::Expand.
This functionality would not be the default of course, but could be
activated with a config parameter.
What do you think? I can try to hack this in HTML::FormFu, just need
to know the internals a little better.
Cheers,
--
Jonas
More information about the Html-widget
mailing list