| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Rose::HTML::Form::Field::TextArea; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
106158
|
use strict; |
|
|
3
|
|
|
|
|
18
|
|
|
|
3
|
|
|
|
|
85
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
15
|
use Carp(); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
59
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
449
|
use Rose::HTML::Object::Errors qw(:string); |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
21
|
use base 'Rose::HTML::Form::Field'; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
2245
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.625'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->add_valid_html_attrs |
|
14
|
|
|
|
|
|
|
( |
|
15
|
|
|
|
|
|
|
'rows', # NUMBER #REQUIRED |
|
16
|
|
|
|
|
|
|
'cols', # NUMBER #REQUIRED |
|
17
|
|
|
|
|
|
|
'disabled', # (disabled) #IMPLIED -- unavailable in this context -- |
|
18
|
|
|
|
|
|
|
'readonly', # (readonly) #IMPLIED |
|
19
|
|
|
|
|
|
|
'onselect', # %Script; #IMPLIED -- some text was selected -- |
|
20
|
|
|
|
|
|
|
'onchange', # %Script; #IMPLIED -- the element value was changed -- |
|
21
|
|
|
|
|
|
|
'minlength', |
|
22
|
|
|
|
|
|
|
'maxlength', |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
|
|
|
|
|
|
rows => 6, |
|
28
|
|
|
|
|
|
|
cols => 50, |
|
29
|
|
|
|
|
|
|
}); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->add_boolean_html_attrs |
|
32
|
|
|
|
|
|
|
( |
|
33
|
|
|
|
|
|
|
'disabled', |
|
34
|
|
|
|
|
|
|
'readonly', |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
1
|
0
|
sub element { 'textarea' } |
|
38
|
28
|
|
|
28
|
1
|
143
|
sub html_element { 'textarea' } |
|
39
|
14
|
|
|
14
|
1
|
71
|
sub xhtml_element { 'textarea' } |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
1
|
8
|
sub value { shift->input_value(@_) } |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub contents |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
1
|
|
|
1
|
1
|
6
|
my($self) = shift; |
|
46
|
1
|
50
|
|
|
|
6
|
return $self->input_value(@_) if(@_); |
|
47
|
0
|
|
|
|
|
0
|
return $self->output_value; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub input_value |
|
51
|
|
|
|
|
|
|
{ |
|
52
|
48
|
|
|
48
|
1
|
88
|
my($self) = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
48
|
100
|
|
|
|
109
|
if(@_) |
|
55
|
|
|
|
|
|
|
{ |
|
56
|
17
|
|
|
|
|
60
|
$self->SUPER::input_value(@_); |
|
57
|
17
|
100
|
|
|
|
64
|
$self->children(defined $_[0] ? $self->output_value : ''); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# XXX: Intentional double set in order to maintain error() |
|
61
|
|
|
|
|
|
|
# XXX: produced by a possible call to inflate_value() |
|
62
|
48
|
|
|
|
|
175
|
return $self->SUPER::input_value(@_); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub clear |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
2
|
|
|
2
|
1
|
7
|
my($self) = shift; |
|
68
|
2
|
|
|
|
|
18
|
$self->delete_children; |
|
69
|
2
|
|
|
|
|
11
|
return $self->SUPER::clear(@_); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub reset |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
2
|
|
|
2
|
1
|
13
|
my($self) = shift; |
|
75
|
2
|
|
|
|
|
13
|
$self->SUPER::reset(@_); |
|
76
|
2
|
|
|
|
|
12
|
$self->children($self->output_value); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub size |
|
80
|
|
|
|
|
|
|
{ |
|
81
|
4
|
|
|
4
|
1
|
479
|
my($self) = shift; |
|
82
|
|
|
|
|
|
|
|
|
83
|
4
|
100
|
|
|
|
11
|
if(@_) |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
2
|
|
|
|
|
5
|
local $_ = shift; |
|
86
|
|
|
|
|
|
|
|
|
87
|
2
|
100
|
|
|
|
16
|
if(my($cols, $rows) = /^(\d+)x(\d+)$/) |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
1
|
|
|
|
|
6
|
$self->cols($cols); |
|
90
|
1
|
|
|
|
|
3
|
$self->rows($rows); |
|
91
|
1
|
|
|
|
|
10
|
return $cols . 'x' . $rows; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
else |
|
94
|
|
|
|
|
|
|
{ |
|
95
|
1
|
|
|
|
|
205
|
Carp::croak "Invalid size argument '$_' is not in the form COLSxROWS"; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
2
|
|
|
|
|
5
|
return $self->cols . 'x' . $self->rows; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub validate |
|
103
|
|
|
|
|
|
|
{ |
|
104
|
4
|
|
|
4
|
1
|
12
|
my($self) = shift; |
|
105
|
|
|
|
|
|
|
|
|
106
|
4
|
|
|
|
|
19
|
my $ok = $self->SUPER::validate(@_); |
|
107
|
4
|
100
|
|
|
|
16
|
return $ok unless($ok); |
|
108
|
|
|
|
|
|
|
|
|
109
|
2
|
|
|
|
|
5
|
my $value = $self->input_value; |
|
110
|
2
|
50
|
33
|
|
|
32
|
return 1 unless(defined $value && length $value); |
|
111
|
|
|
|
|
|
|
|
|
112
|
2
|
|
|
|
|
34
|
my $maxlength = $self->maxlength; |
|
113
|
|
|
|
|
|
|
|
|
114
|
2
|
0
|
|
0
|
|
12
|
my $name = sub { $self->label || $self->name }; |
|
|
0
|
|
|
|
|
0
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
2
|
100
|
66
|
|
|
11
|
if(defined $maxlength && length($value) > $maxlength) |
|
117
|
|
|
|
|
|
|
{ |
|
118
|
1
|
|
|
|
|
7
|
$self->add_error_id(STRING_OVERFLOW, { label => $name, maxlength => $maxlength }); |
|
119
|
1
|
|
|
|
|
6
|
return 0; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
6
|
return 1; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
1; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 NAME |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Rose::HTML::Form::Field::TextArea - Object representation of a multi-line text field in an HTML form. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$field = |
|
135
|
|
|
|
|
|
|
Rose::HTML::Form::Field::TextArea->new( |
|
136
|
|
|
|
|
|
|
label => 'Comments', |
|
137
|
|
|
|
|
|
|
name => 'comments', |
|
138
|
|
|
|
|
|
|
rows => 2, |
|
139
|
|
|
|
|
|
|
cols => 50); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$comments = $field->internal_value; |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
print $field->html; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
... |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::TextArea> is an object representation of a multi-line text field in an HTML form. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This class inherits from, and follows the conventions of, L<Rose::HTML::Form::Field>. Inherited methods that are not overridden will not be documented a second time here. See the L<Rose::HTML::Form::Field> documentation for more information. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 HTML ATTRIBUTES |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Valid attributes: |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
accesskey |
|
158
|
|
|
|
|
|
|
class |
|
159
|
|
|
|
|
|
|
cols |
|
160
|
|
|
|
|
|
|
dir |
|
161
|
|
|
|
|
|
|
disabled |
|
162
|
|
|
|
|
|
|
id |
|
163
|
|
|
|
|
|
|
lang |
|
164
|
|
|
|
|
|
|
name |
|
165
|
|
|
|
|
|
|
onblur |
|
166
|
|
|
|
|
|
|
onchange |
|
167
|
|
|
|
|
|
|
onclick |
|
168
|
|
|
|
|
|
|
ondblclick |
|
169
|
|
|
|
|
|
|
onfocus |
|
170
|
|
|
|
|
|
|
onkeydown |
|
171
|
|
|
|
|
|
|
onkeypress |
|
172
|
|
|
|
|
|
|
onkeyup |
|
173
|
|
|
|
|
|
|
onmousedown |
|
174
|
|
|
|
|
|
|
onmousemove |
|
175
|
|
|
|
|
|
|
onmouseout |
|
176
|
|
|
|
|
|
|
onmouseover |
|
177
|
|
|
|
|
|
|
onmouseup |
|
178
|
|
|
|
|
|
|
onselect |
|
179
|
|
|
|
|
|
|
readonly |
|
180
|
|
|
|
|
|
|
rows |
|
181
|
|
|
|
|
|
|
style |
|
182
|
|
|
|
|
|
|
tabindex |
|
183
|
|
|
|
|
|
|
title |
|
184
|
|
|
|
|
|
|
value |
|
185
|
|
|
|
|
|
|
xml:lang |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Required attributes (default values in parentheses): |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
cols (50) |
|
190
|
|
|
|
|
|
|
rows (6) |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Boolean attributes: |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
checked |
|
195
|
|
|
|
|
|
|
disabled |
|
196
|
|
|
|
|
|
|
readonly |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=over 4 |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item B<new PARAMS> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Constructs a new L<Rose::HTML::Form::Field::TextArea> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=back |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=over 4 |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item B<contents [TEXT]> |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Get or set the contents of the text area. If a TEXT argument is present, it is passed to L<input_value()|Rose::HTML::Form::Field/input_value> and the return value of that method call is then returned. Otherwise, L<output_value()|Rose::HTML::Form::Field/output_value> is called with no arguments. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item B<maxlength [INT]> |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Get or set the maximum length of the input value. Note that this is not an HTML attribute; this limit is enforced by the L<validate|Rose::HTML::Form::Field/validate> method, not by the web browser. |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item B<size [COLSxROWS]> |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Get or set the number of columns and rows (C<cols> and C<rows>) in the text area in the form of a string "COLSxROWS". For example, "40x3" means 40 columns and 3 rows. If the size argument is not in the correct format, a fatal error will occur. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item B<value [TEXT]> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Simply calls L<input_value|Rose::HTML::Form::Field/input_value>, passing all arguments. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=back |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 AUTHOR |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 LICENSE |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |