From 5a1619f4f731dc6ff895d3c300ab320b18509a28 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 3 Dec 2008 00:32:18 +0000 Subject: [PATCH] use proper method of formatting text for display in Textarea form control --- lib/WebGUI/Form/Textarea.pm | 3 +-- t/Form/Textarea.t | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Form/Textarea.pm b/lib/WebGUI/Form/Textarea.pm index 5d250c632..88db88d73 100644 --- a/lib/WebGUI/Form/Textarea.pm +++ b/lib/WebGUI/Form/Textarea.pm @@ -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/
/sg; + $value = WebGUI::HTML::format($value, 'text'); return $value; } diff --git a/t/Form/Textarea.t b/t/Form/Textarea.t index 6d6399228..1aa97a92b 100644 --- a/t/Form/Textarea.t +++ b/t/Form/Textarea.t @@ -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
line2
line3', 'getValueAsHtml translates newlines into break tags'); +is($txt->getValueAsHtml, "line1
\nline2
\nline3", 'getValueAsHtml translates newlines into break tags'); __END__