fix EMSSubmissionForm and all its tests

This commit is contained in:
Doug Bell 2011-05-04 15:33:04 -05:00
parent 0c23ba8cd7
commit b0da37ec15
8 changed files with 81 additions and 64 deletions

View file

@ -162,7 +162,7 @@ sub toHtml {
$self->headTags;
my $session = $self->session;
my $output = '<fieldset style="border:none;margin:0;padding:0">';
$output .= WebGUI::Form::Hidden($session, { name => $self->privateName('isIn'), value => 1, });
$output .= WebGUI::Form::Hidden->new($session, { name => $self->privateName('isIn'), value => 1, })->toHtml;
my $alignment = $self->alignmentSeparator;
# Add the select all button

View file

@ -156,7 +156,7 @@ sub definition {
my $definition = shift || [];
push(@{$definition}, {
name=>{
defaultValue=>undef
defaultValue=>''
},
value=>{
defaultValue=>undef

View file

@ -37,6 +37,18 @@ The following methods are specifically available from this class. Check the supe
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
push(@{$definition}, {
# Should we show the hidden field too?
addHidden => {
defaultValue => 1,
},
});
return $definition;
}
#-------------------------------------------------------------------
=head2 getName ( session )
@ -73,7 +85,7 @@ Renders the value and a hidden input type if a "name" attribute was specified.
sub toHtml {
my $self = shift;
my $out = $self->getOriginalValue;
if ($self->get('name') ne '') {
if ($self->get('addHidden') && $self->get('name') ne '') {
$out .= $self->toHtmlAsHidden;
}
return $out;
@ -89,7 +101,7 @@ Outputs nothing unless a "name" attribute was specified.
sub toHtmlAsHidden {
my $self = shift;
if ($self->get('name') ne '') {
if ($self->get('addHidden') && $self->get('name') ne '') {
return $self->SUPER::toHtmlAsHidden;
}
return undef;