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