Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTML-FormHandler CPAN distribution.

Report information
The Basics
Id: 75666
Status: resolved
Priority: 0/
Queue: HTML-FormHandler

People
Owner: Nobody in particular
Requestors: JNWHITLEY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.40001
Fixed in: (no value)



Subject: HTML::FormHandler Broken on upgrade
I have a problem rendering forms - there is an error on an anon class (which is a HTML::FormHandler child class instance) not being able to find the element_attr method. It may be that the HFH universe has changed, and I am now doing the wrong thing (actually, this is quite likely ;) ). However, there seems to be an assumption made in HTML::FormHandler::Widget::Form::Role::HTMLAttributes that everything is a field, based on the following assumption: Form classes have element_attr . My reading of a form class is that it has form_element_attr - but these methods appear (to the lay reader) to be equivalent. As always when making such assumptions, I am showing a probable ignorance; as there is almost certainly a good design decision for having one for fields and another for forms. However, it is this that is breaking the rendering of the form. I've attached a patch ( diff -e ) that makes things work on my installation. Hopefully I haven't just committed a heresy. I hope this helps! ( sudo patch -e /usr/local/share/perl/5.12.4/HTML/FormHandler/Widget/Form/Role/HTMLAttributes.pm HTMLAttributes.patch ) Thanks for all your work on HTML::FormHandler. It really has become one of my favourite packages. Life is so much better for it!
Subject: HTMLAttributes.patch
18c # 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' ) ); .
The HTMLAttributes role is no longer used by FormHandler itself, but was left there for compatibility with existing code. Thanks for the patch. It's been applied to the repo and will go out in the next release (probably in a couple of days). The new code now uses the process_attrs function instead of HTMLAttributes. If you want to switch to using that, you can look in the widget and Render::Simple code. It's something like: my $attrs = process_attrs($self->form_element_attributes($result)); Sorry for the breakage. There were so many changes (improvements, I hope) that it couldn't be avoided.
Fix shipped last week.