use proper method of formatting text for display in Textarea form

control
This commit is contained in:
Graham Knop 2008-12-03 00:32:18 +00:00
parent a71e494d34
commit 5a1619f4f7
2 changed files with 2 additions and 3 deletions

View file

@ -193,8 +193,7 @@ sub toHtml {
sub getValueAsHtml {
my $self = shift;
my $value = $self->SUPER::getValueAsHtml(@_);
$value = WebGUI::HTML::filter($value, 'text');
$value =~ s/\n/<br>/sg;
$value = WebGUI::HTML::format($value, 'text');
return $value;
}

View file

@ -111,7 +111,7 @@ is($session->form->textarea(undef,"some \ntest \r\nhere"), "some \ntest \r\nhere
###################################################################
$txt = WebGUI::Form::Textarea->new($session, { value => "line1\nline2\nline3", });
is($txt->getValueAsHtml, 'line1<br>line2<br>line3', 'getValueAsHtml translates newlines into break tags');
is($txt->getValueAsHtml, "line1<br />\nline2<br />\nline3", 'getValueAsHtml translates newlines into break tags');
__END__