html-formhandler icon indicating copy to clipboard operation
html-formhandler copied to clipboard

tag no_wrapper_id does not work

Open bokutin opened this issue 2 years ago • 0 comments

https://github.com/gshank/html-formhandler/blob/b0325394b2c93fb79e81ea7067996297affbcc01/lib/HTML/FormHandler/Field.pm#L1017

Specifying "has_field field_name => ( tags => { no_wrapper_id => 1 } )" does not make it false because this line evaluates to

$self->has_flag('is_compound') && not (exists $attr->{id} && !$self->get_tag('no_wrapper_id'))

I think the following is correct.

$self->has_flag('is_compound') && !exists $attr->{id} && !$self->get_tag('no_wrapper_id')

Patch for private FreeBSD ports tree.

--- lib/HTML/FormHandler/Field.pm.orig  2017-07-20 16:51:00 UTC
+++ lib/HTML/FormHandler/Field.pm
@@ -464,7 +464,7 @@ sub wrapper_attributes {
     $attr->{class} = $class if @$class;
     # add id if compound field and id doesn't exist unless 'no_wrapper_id' tag
     $attr->{id} = $self->id
-        if ( $self->has_flag('is_compound') && not exists $attr->{id} && ! $self->get_tag('no_wrapper_id') );
+        if ( $self->has_flag('is_compound') && !exists $attr->{id} && ! $self->get_tag('no_wrapper_id') );
     # call form hook
     my $mod_attr = $self->form->html_attributes($self, 'wrapper', $attr, $result) if $self->form;
     return ref($mod_attr) eq 'HASH' ? $mod_attr : $attr;

bokutin avatar Dec 06 '22 11:12 bokutin