| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Rose::HTML::Form::Field::Text; |
|
2
|
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
220220
|
use strict; |
|
|
17
|
|
|
|
|
130
|
|
|
|
17
|
|
|
|
|
616
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
17
|
|
|
17
|
|
10059
|
use Encode; |
|
|
17
|
|
|
|
|
169928
|
|
|
|
17
|
|
|
|
|
1397
|
|
|
6
|
17
|
|
|
17
|
|
2051
|
use Rose::HTML::Object::Errors qw(:string); |
|
|
17
|
|
|
|
|
50
|
|
|
|
17
|
|
|
|
|
139
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
127
|
use base 'Rose::HTML::Form::Field::Input'; |
|
|
17
|
|
|
|
|
43
|
|
|
|
17
|
|
|
|
|
8464
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.606'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->delete_valid_html_attrs(qw(ismap usemap alt src)); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->add_required_html_attrs( |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
|
|
|
|
|
|
type => 'text', |
|
17
|
|
|
|
|
|
|
name => '', |
|
18
|
|
|
|
|
|
|
size => 15, |
|
19
|
|
|
|
|
|
|
value => '', |
|
20
|
|
|
|
|
|
|
}); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub html_field |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
145
|
|
|
145
|
1
|
5113
|
my($self) = shift; |
|
25
|
145
|
|
|
|
|
595
|
$self->html_attr(value => $self->output_value); |
|
26
|
145
|
|
|
|
|
588
|
return $self->SUPER::html_field(@_); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub xhtml_field |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
98
|
|
|
98
|
1
|
260
|
my($self) = shift; |
|
32
|
98
|
|
|
|
|
315
|
$self->html_attr(value => $self->output_value); |
|
33
|
98
|
|
|
|
|
425
|
return $self->SUPER::xhtml_field(@_); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub validate |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
134
|
|
|
134
|
1
|
298
|
my($self) = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
134
|
|
|
|
|
423
|
my $ok = $self->SUPER::validate(@_); |
|
41
|
134
|
100
|
|
|
|
335
|
return $ok unless($ok); |
|
42
|
|
|
|
|
|
|
|
|
43
|
123
|
|
|
|
|
303
|
my $value = $self->input_value; |
|
44
|
123
|
50
|
|
|
|
357
|
$value = $self->output_value if(ref $value); |
|
45
|
123
|
100
|
100
|
|
|
560
|
return 1 unless(defined $value && length $value); |
|
46
|
|
|
|
|
|
|
|
|
47
|
97
|
|
|
|
|
321
|
my $maxlength = $self->maxlength; |
|
48
|
|
|
|
|
|
|
|
|
49
|
97
|
0
|
|
0
|
|
512
|
my $name = sub { $self->error_label || $self->name }; |
|
|
0
|
|
|
|
|
0
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
97
|
100
|
66
|
|
|
450
|
if(ref($self)->force_utf8 && !Encode::is_utf8($value)) |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
1
|
|
|
|
|
18
|
Encode::_utf8_on($value); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
97
|
100
|
100
|
|
|
6609
|
if(defined $maxlength && length($value) > $maxlength) |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
3
|
|
|
|
|
20
|
$self->add_error_id(STRING_OVERFLOW, { label => $name, maxlength => $maxlength }); |
|
59
|
3
|
|
|
|
|
18
|
return 0; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
94
|
|
|
|
|
509
|
return 1; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
if(__PACKAGE__->localizer->auto_load_messages) |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
|
|
|
|
|
|
__PACKAGE__->localizer->load_all_messages; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
17
|
|
|
17
|
|
289
|
use utf8; # The __DATA__ section contains UTF-8 text |
|
|
17
|
|
|
|
|
40
|
|
|
|
17
|
|
|
|
|
146
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__DATA__ |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
[% LOCALE en %] |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
STRING_OVERFLOW = "[label] must not exceed [maxlength] characters." |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
[% LOCALE bg %] |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
STRING_OVERFLOW = "Полето '[label]' не трябва да надхвърля [maxlength] символа." |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Text - Object representation of a text field in an HTML form. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$field = |
|
93
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Text->new( |
|
94
|
|
|
|
|
|
|
label => 'Your Age', |
|
95
|
|
|
|
|
|
|
name => 'age', |
|
96
|
|
|
|
|
|
|
size => 2, |
|
97
|
|
|
|
|
|
|
maxlength => 3); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$age = $field->internal_value; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
print $field->html; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
... |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::Text> is an object representation of a text field in an HTML form. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
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. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 HTML ATTRIBUTES |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Valid attributes: |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
accept |
|
116
|
|
|
|
|
|
|
accesskey |
|
117
|
|
|
|
|
|
|
checked |
|
118
|
|
|
|
|
|
|
class |
|
119
|
|
|
|
|
|
|
dir |
|
120
|
|
|
|
|
|
|
disabled |
|
121
|
|
|
|
|
|
|
id |
|
122
|
|
|
|
|
|
|
lang |
|
123
|
|
|
|
|
|
|
maxlength |
|
124
|
|
|
|
|
|
|
name |
|
125
|
|
|
|
|
|
|
onblur |
|
126
|
|
|
|
|
|
|
onchange |
|
127
|
|
|
|
|
|
|
onclick |
|
128
|
|
|
|
|
|
|
ondblclick |
|
129
|
|
|
|
|
|
|
onfocus |
|
130
|
|
|
|
|
|
|
onkeydown |
|
131
|
|
|
|
|
|
|
onkeypress |
|
132
|
|
|
|
|
|
|
onkeyup |
|
133
|
|
|
|
|
|
|
onmousedown |
|
134
|
|
|
|
|
|
|
onmousemove |
|
135
|
|
|
|
|
|
|
onmouseout |
|
136
|
|
|
|
|
|
|
onmouseover |
|
137
|
|
|
|
|
|
|
onmouseup |
|
138
|
|
|
|
|
|
|
onselect |
|
139
|
|
|
|
|
|
|
readonly |
|
140
|
|
|
|
|
|
|
size |
|
141
|
|
|
|
|
|
|
style |
|
142
|
|
|
|
|
|
|
tabindex |
|
143
|
|
|
|
|
|
|
title |
|
144
|
|
|
|
|
|
|
type |
|
145
|
|
|
|
|
|
|
value |
|
146
|
|
|
|
|
|
|
xml:lang |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Required attributes (default values in parentheses): |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
name |
|
151
|
|
|
|
|
|
|
size (15) |
|
152
|
|
|
|
|
|
|
type (text) |
|
153
|
|
|
|
|
|
|
value |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Boolean attributes: |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
checked |
|
158
|
|
|
|
|
|
|
disabled |
|
159
|
|
|
|
|
|
|
readonly |
|
160
|
|
|
|
|
|
|
required |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=over 4 |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item B<new PARAMS> |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Constructs a new L<Rose::HTML::Form::Field::Text> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=back |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 AUTHOR |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 LICENSE |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
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. |