Subject: | Multiple Submit Buttons |
Multiple submit fields require force_default => 0, retain_default => 1
to be set for each submit field in order to function as expected.
By default $form->params() shows values for both Submit fields despite
Catalyst showing the browser only sent a single field.
Here is a Multi-field Element which shows the problem. Include it and
dump $form->params() on submit/preview. Uncomment the commented lines
and retry.
package PreviewSubmit;
use Moose;
extends qw{HTML::FormFu::Element::Multi};
after BUILD => sub {
my $self = shift;
$self->label(q{});
$self->type('submit');
$self->element(
{ type => 'Submit',
name => 'preview',
default => 'Preview',
# force_default => 0,
# retain_default => 1,
}
);
$self->element(
{ type => 'Submit',
name => 'submitit',
default => 'Submit',
# force_default => 0,
# retain_default => 1,
}
);
return;
};