Permalink
Browse files

remove writeonly flag from Display field, so that it can hold item va…

…lues
  • Loading branch information...
gshank committed Mar 18, 2013
1 parent ca1ba8a commit f403eac1783a207909dc3dd205f013d62d576c36
Showing with 29 additions and 1 deletion.
  1. +0 −1 lib/HTML/FormHandler/Field/NoValue.pm
  2. +29 −0 t/fields/display.t
@@ -47,7 +47,6 @@ sub _result_from_object {
sub fif { }
has '+widget' => ( default => '' );
-has '+writeonly' => ( default => 1 );
has '+noupdate' => ( default => 1 );
sub validate_field { }
View
@@ -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.