Navigation Menu

Skip to content

Commit

Permalink
Patch HTMLAttributes to work for both form and fields
Browse files Browse the repository at this point in the history
  • Loading branch information
John Whitley authored and gshank committed Mar 10, 2012
1 parent 76c91e9 commit dc381a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/HTML/FormHandler/Widget/Form/Role/HTMLAttributes.pm
Expand Up @@ -15,7 +15,13 @@ sub html_form_tag {
[ style => 'style' ],
);

my $element_attr = { %{$self->element_attr} };
# make the element_attr a safe default
my $element_attr = {};
# Assuming that self is a form
$element_attr = { %{$self->form_element_attr} } if ( $self->can( 'form_element_attr' ) );
# Assuming that self is a field
$element_attr = { %{$self->element_attr} } if ( $self->can( 'element_attr' ) );

foreach my $attr_pair (@attr_accessors) {
my $attr = $attr_pair->[0];
my $accessor = $attr_pair->[1];
Expand Down

0 comments on commit dc381a7

Please sign in to comment.