| 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 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 2 | ▶ | no warnings 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 2 | ▶ | use CGI::FormBuilder::Util; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 2 | ▶ | use CGI::FormBuilder::Field::text; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 2 | ▶ | use base 'CGI::FormBuilder::Field::text'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | |||
| 24 | 2 | our $VERSION = '3.10'; | |
| 25 | |||
| 26 | 2 | *render = \&tag; | |
| 27 | sub tag { | ||
| 28 | 6 | ▶ | local $^W = 0; # -w sucks |
|
Subroutine
tag: called CC=1 SCAR=0.0
Pod
documented
| |||
| 29 | 6 | my $self = shift; | |
| 30 | 6 | my $attr = $self->attr; | |
| 31 | |||
| 32 | 6 | my $jspre = $self->{_form}->jsprefix; | |
| 33 | |||
| 34 | 6 | my $tag = ''; | |
| 35 | 6 | my @value = $self->tag_value; # sticky is different in <tag> | |
| 36 | |||
| 37 | 6 | delete $attr->{type}; # <textarea type="textarea"> invalid | |
| 38 | |||
| 39 | 6 | my $text = join "\n", @value; | |
| 40 | 6 | $tag .= htmltag('textarea', $attr) . escapehtml($text) . '</textarea>'; | |
| 41 | |||
| 42 | 6 | debug 2, "$self->{name}: generated tag = $tag"; | |
| 43 | 6 | return $tag; # always return scalar tag | |
| 44 | } | ||
| 45 | |||
| 46 | 2 | 1; | |
| 47 | |||
| 48 | __END__ | ||