[html-formfu] Accessing a form element which is not in the table
Octavian Râşniţă
orasnita at gmail.com
Sat Dec 19 15:24:11 GMT 2009
From: "Carl Franks" <fireartist at gmail.com>
2009/12/17 Octavian Râşniţă <orasnita at gmail.com>:
> Hi,
>
> Is it possible to access (in a DBIx::Class inflator) an HTML::FormFu
> element
> that doesn't have a corresponding field in the db table?
>
> I need to let the user specify an option in a separate form field
> (checkbox), and depending on that option to replace or not replace another
> field in the database, but the value of that checkbox should not be
> entered
> in the database because there is no field for it there.
I suspect this logic should be handled by the form - not the database layer.
I'd suggest writing a HTML::FormFu::Transformer subclass to do it.
Carl
I made an HTML::FormFu transformer that just needs to set a {} instead an
undef value for a File element, but it doesn't work. If I use the same
transformer for a Text field, it works fine.
Is the File element special and it can't be transformed?
As a test, I put the transformer to return a static value of "blabla". It is
returned fine for a Text element, but for the File type element, after
applying the transformer, the value is a null one.
I have printed:
$form->param('file')
and
$c->req->params->{file}
after applying the transformer, but both of them contain just a null value.
Thanks.
Octavian
More information about the HTML-FormFu
mailing list