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