line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
6
|
|
|
6
|
|
184884
|
|
|
6
|
|
|
|
|
37
|
|
|
6
|
|
|
|
|
178
|
|
4
|
|
|
|
|
|
|
use base 'Rose::HTML::Form::Field::OnOff::Checkable'; |
5
|
6
|
|
|
6
|
|
28
|
|
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2078
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.617'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->delete_valid_html_attrs(qw(ismap usemap alt src)); |
9
|
|
|
|
|
|
|
__PACKAGE__->required_html_attr_value(type => 'checkbox'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
{ |
12
|
|
|
|
|
|
|
my($self) = shift; |
13
|
|
|
|
|
|
|
$self->html_attr(checked => $self->checked); |
14
|
124
|
|
|
124
|
1
|
727
|
return $self->SUPER::html_field(@_); |
15
|
124
|
|
|
|
|
283
|
} |
16
|
124
|
|
|
|
|
325
|
|
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
my($self) = shift; |
19
|
|
|
|
|
|
|
$self->html_attr(checked => $self->checked); |
20
|
|
|
|
|
|
|
return $self->SUPER::xhtml_field(@_); |
21
|
69
|
|
|
69
|
1
|
433
|
} |
22
|
69
|
|
|
|
|
142
|
|
23
|
69
|
|
|
|
|
244
|
{ |
24
|
|
|
|
|
|
|
my($self) = shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return ($self->html_prefix || '') . |
27
|
|
|
|
|
|
|
$self->html_checkbox . ' ' . $self->html_label . |
28
|
121
|
|
|
121
|
1
|
667
|
($self->html_suffix || ''); |
29
|
|
|
|
|
|
|
} |
30
|
121
|
|
50
|
|
|
242
|
|
|
|
|
50
|
|
|
|
|
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
my($self) = shift; |
33
|
|
|
|
|
|
|
return ($self->html_prefix || '') . |
34
|
|
|
|
|
|
|
$self->xhtml_checkbox . ' ' . $self->html_label . |
35
|
|
|
|
|
|
|
($self->html_suffix || ''); |
36
|
|
|
|
|
|
|
} |
37
|
66
|
|
|
66
|
1
|
100
|
|
38
|
66
|
|
50
|
|
|
138
|
1; |
|
|
|
50
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Checkbox - Object representation of a single checkbox field in an HTML form. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$field = |
48
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Checkbox->new( |
49
|
|
|
|
|
|
|
label => 'Run tests', |
50
|
|
|
|
|
|
|
name => 'tests', |
51
|
|
|
|
|
|
|
value => 'yes'); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$checked = $field->is_checked; # false |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$field->checked(1); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
print $field->html; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
... |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L<Rose::HTML::Form::Field::Checkbox> is an object representation of a single checkbox field in an HTML form. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
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. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 HTML ATTRIBUTES |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Valid attributes: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
accept |
72
|
|
|
|
|
|
|
accesskey |
73
|
|
|
|
|
|
|
checked |
74
|
|
|
|
|
|
|
class |
75
|
|
|
|
|
|
|
dir |
76
|
|
|
|
|
|
|
disabled |
77
|
|
|
|
|
|
|
id |
78
|
|
|
|
|
|
|
lang |
79
|
|
|
|
|
|
|
maxlength |
80
|
|
|
|
|
|
|
name |
81
|
|
|
|
|
|
|
onblur |
82
|
|
|
|
|
|
|
onchange |
83
|
|
|
|
|
|
|
onclick |
84
|
|
|
|
|
|
|
ondblclick |
85
|
|
|
|
|
|
|
onfocus |
86
|
|
|
|
|
|
|
onkeydown |
87
|
|
|
|
|
|
|
onkeypress |
88
|
|
|
|
|
|
|
onkeyup |
89
|
|
|
|
|
|
|
onmousedown |
90
|
|
|
|
|
|
|
onmousemove |
91
|
|
|
|
|
|
|
onmouseout |
92
|
|
|
|
|
|
|
onmouseover |
93
|
|
|
|
|
|
|
onmouseup |
94
|
|
|
|
|
|
|
onselect |
95
|
|
|
|
|
|
|
readonly |
96
|
|
|
|
|
|
|
size |
97
|
|
|
|
|
|
|
style |
98
|
|
|
|
|
|
|
tabindex |
99
|
|
|
|
|
|
|
title |
100
|
|
|
|
|
|
|
type |
101
|
|
|
|
|
|
|
value |
102
|
|
|
|
|
|
|
xml:lang |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Required attributes (default values in parentheses): |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
type (checkbox) |
107
|
|
|
|
|
|
|
value |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Boolean attributes: |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
checked |
112
|
|
|
|
|
|
|
disabled |
113
|
|
|
|
|
|
|
readonly |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over 4 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item B<new PARAMS> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Constructs a new L<Rose::HTML::Form::Field::Checkbox> object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 4 |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item B<checked [BOOL]> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Check or uncheck the checkbox by passing a boolean value. If BOOL is true, the checkbox will be checked. If it is false, it will be unchecked. Returns true if the checkbox is checked, false otherwise. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item B<hidden [BOOL]> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Get or set a boolean value that indicates whether or not this checkbox will be shown in its parent L<checkbox group|Rose::HTML::Form::Field::CheckboxGroup>. Setting it to true also sets L<checked|/checked> to false. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item B<hide> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Calls L<hidden|/hidden>, passing a true value. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item B<html_checkbox> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns the HTML serialization of the checkbox field only (i.e., without any label or error message) |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item B<is_checked> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns true if the checkbox is checked, false otherwise. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item B<is_on> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Simply calls L<is_checked|/is_checked>. This method exists for API uniformity between radio buttons and checkboxes. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item B<show> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Calls L<hidden|/hidden>, passing a false value. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item B<value [VALUE]> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Gets or sets the value of the "value" HTML attribute. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item B<xhtml_checkbox> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns the XHTML serialization of the checkbox field only (i.e., without any label or error message) |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item B<label_object> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns the object representing the L<label|Rose::HTML::Label> for the checkbox. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Example: |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
$field = |
172
|
|
|
|
|
|
|
Rose::HTML::Form::Field::Checkbox->new( |
173
|
|
|
|
|
|
|
label => 'Run tests', |
174
|
|
|
|
|
|
|
name => 'tests', |
175
|
|
|
|
|
|
|
value => 'yes'); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
$field->label_object->add_class('checkbox_label'); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=back |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 AUTHOR |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
John C. Siracusa (siracusa@gmail.com) |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 LICENSE |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
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. |