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: 83528
Status: resolved
Priority: 0/
Queue: HTML-FormHandler

People
Owner: Nobody in particular
Requestors: chen.yack [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.40020
Fixed in: (no value)



Subject: policy error in HTML::FormHandler::InitResult
Download (untitled) / with headers
text/plain 1.9k
When I use HTML::FormHandler::Model::DBIC. I has following Form: package MyForm; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Model::DBIC'; use namespace::autoclean; use utf8; has '+item_class' => ( default => 'Preplan' ); has_field 'name' => ( type => 'Text' , required => 1 ); has_field 'actions' => ( type => '+MyForm::Preplan::PreplanActionShipField', do_wrapper => 1, do_label => 1, required => 1, accessor => 'preplan_preplanactionships', ); package MyForm::Preplan::PreplanActionShipField; use HTML::FormHandler::Moose; extends 'HTML::FormHandler::Field::Repeatable'; use namespace::autoclean; use utf8; has_field 'delete' => ( type => 'Button', do_wrapper => 0, do_label => 0, element_class => [ qw( btn btn-small btn-danger) ], value => 'Delete', ); has_field 'priority' => ( type => 'Integer', element_class => [ qw(input input-small) ], do_wrapper => 0, do_label => 0, required => 1, ); ================spliter====================== create form : my $form = MyForm( item => $item); now, i found that the "delete" field also fetch from "item" ==> my database; which make the resultrow deleted. what i wanna is that delete just a NoValue field, it shouldnot fetch from database. When i debug to the HTML::FormHandler source code. i found that the issue is in HTML::FormHandler::InitResult, in following line. 88 my $value = $self->_get_value( $field, $item ); 89 $result = $field->_result_from_object( $result, $value ); IF the Field is a NoValue Field, but $item is a DBIx::Class's resultrow, the _get_value function in line 88 will be called. which fetch the value from database by calling the $field->accessor, so the $item->delete() called. hence, my resultrow was deleted !! ====OK==== I think you should check the $field's type, than do something correct. maybe other method ? hope you fix this issue :)
This has been fixed and released.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.