| 1 | |||
| 2 | ########################################################################### | ||
| 3 | # Copyright (c) Nate Wiger http://nateware.com. All Rights Reserved. | ||
| 4 | # Please visit http://formbuilder.org for tutorials, support, and examples. | ||
| 5 | ########################################################################### | ||
| 6 | |||
| 7 | # The majority of this module's methods (including new) are | ||
| 8 | # inherited directly from ::base, since they involve things | ||
| 9 | # which are common, such as parameter parsing. The only methods | ||
| 10 | # that are individual to different fields are those that affect | ||
| 11 | # the rendering, such as script() and tag() | ||
| 12 | |||
| 13 | package CGI::FormBuilder::Field::textarea; | ||
| 14 | |||
| 15 | use strict; | ||
| 16 | use warnings; | ||
| 17 | no warnings 'uninitialized'; | ||
| 18 | |||
| 19 | use CGI::FormBuilder::Util; | ||
| 20 | use CGI::FormBuilder::Field::text; | ||
| 21 | use base 'CGI::FormBuilder::Field::text'; | ||
| 22 | |||
| 23 | |||
| 24 | our $VERSION = '3.10'; | ||
| 25 | |||
| 26 | *render = \&tag; | ||
| 27 | sub tag { | ||
| 28 | local $^W = 0; # -w sucks | ||
| 29 | my $self = shift; | ||
| 30 | my $attr = $self->attr; | ||
| 31 | |||
| 32 | my $jspre = $self->{_form}->jsprefix; | ||
| 33 | |||
| 34 | my $tag = ''; | ||
| 35 | my @value = $self->tag_value; # sticky is different in <tag> | ||
| 36 | |||
| 37 | delete $attr->{type}; # <textarea type="textarea"> invalid | ||
| 38 | |||
| 39 | my $text = join "\n", @value; | ||
| 40 | $tag .= htmltag('textarea', $attr) . escapehtml($text) . '</textarea>'; | ||
| 41 | |||
| 42 | debug 2, "$self->{name}: generated tag = $tag"; | ||
| 43 | return $tag; # always return scalar tag | ||
| 44 | } | ||
| 45 | |||
| 46 | 1; | ||
| 47 | |||
| 48 | __END__ |