Skip to content

Commit

Permalink
remove writeonly flag from Display field, so that it can hold item va…
Browse files Browse the repository at this point in the history
…lues
  • Loading branch information
gshank committed Mar 18, 2013
1 parent ca1ba8a commit f403eac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/HTML/FormHandler/Field/NoValue.pm
Expand Up @@ -47,7 +47,6 @@ sub _result_from_object {
sub fif { }

has '+widget' => ( default => '' );
has '+writeonly' => ( default => 1 );
has '+noupdate' => ( default => 1 );

sub validate_field { }
Expand Down
29 changes: 29 additions & 0 deletions t/fields/display.t
@@ -0,0 +1,29 @@
use strict;
use warnings;
use Test::More;

# this tests to make sure that a display field can take a value
{
package MyApp::Form::Test;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';

has_field 'foo' => ( type => 'Display', label => undef, required => 0, noupdate => 1 );
has_field 'bar' => ( type => 'Text' );

}

my $form = MyApp::Form::Test->new;
ok( $form );

my $init_obj = {
foo => 'some foo',
bar => 'a bar',
};

$form->process( init_object => $init_obj, params => {} );
is( $form->field('foo')->value, 'some foo', 'foo field has a value' );

my $rendered = $form->render;

done_testing;

0 comments on commit f403eac

Please sign in to comment.