[html-formfu] Patch to have $params in Transformer callbacks
Carl Franks
fireartist at gmail.com
Thu Jun 5 10:02:18 BST 2008
2008/5/23 Michele Beltrame <mb at cattlegrid.info>:
> Hello!
>
> I found myself doing transformations (via callbacks) on a field
> depending on other fields of a form. Such as:
>
> transformers => [{
> type => 'Callback',
> callback => sub {
> my ($v, $p) = @_;
> return $p->{birth_defects} == 1 ? $v : 'other';
> },
> }],
>
> I discovered that, unlike in Constrains, the other form fields are
> not passed to Transformers as a second parameter.
>
> Here's a patch to achieve this. If (Carl) you think it's OK, I can
> commit it myself along with a test and documentation changes.
Sorry it's taken to long so pick this up.
Yes - this looks good, particularly as Transformer::process() is
already being passed $params.
If you could add a quick test and commit it, that'd be great.
Thanks,
Carl
More information about the HTML-FormFu
mailing list