line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::Element::Textfield; |
2
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
109852
|
use warnings; |
|
88
|
|
|
|
|
187
|
|
|
88
|
|
|
|
|
2645
|
|
4
|
88
|
|
|
88
|
|
444
|
use strict; |
|
88
|
|
|
|
|
200
|
|
|
88
|
|
|
|
|
2676
|
|
5
|
88
|
|
|
88
|
|
436
|
use base 'HTML::Widget::Element'; |
|
88
|
|
|
|
|
154
|
|
|
88
|
|
|
|
|
35915
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/comment label value retain_default/); |
8
|
|
|
|
|
|
|
__PACKAGE__->mk_attr_accessors(qw/size maxlength/); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
HTML::Widget::Element::Textfield - Textfield Element |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $e = $widget->element( 'Textfield', 'foo' ); |
17
|
|
|
|
|
|
|
$e->comment('(Required)'); |
18
|
|
|
|
|
|
|
$e->label('Foo'); |
19
|
|
|
|
|
|
|
$e->size(23); |
20
|
|
|
|
|
|
|
$e->maxlength(42); |
21
|
|
|
|
|
|
|
$e->value('bar'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Textfield Element. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 retain_default |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
If true, overrides the default behaviour, so that after a field is missing |
32
|
|
|
|
|
|
|
from the form submission, the xml output will contain the default value, |
33
|
|
|
|
|
|
|
rather than be empty. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 containerize |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub containerize { |
40
|
102
|
|
|
102
|
1
|
2914
|
my ( $self, $w, $value, $errors, $args ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
102
|
100
|
100
|
|
|
483
|
$value = $self->value |
|
|
|
66
|
|
|
|
|
43
|
|
|
|
|
|
|
if ( not defined $value ) |
44
|
|
|
|
|
|
|
and $self->retain_default || not $args->{submitted}; |
45
|
|
|
|
|
|
|
|
46
|
102
|
50
|
|
|
|
1046
|
$value = ref $value eq 'ARRAY' ? shift @$value : $value; |
47
|
|
|
|
|
|
|
|
48
|
102
|
|
|
|
|
367
|
my $l = $self->mk_label( $w, $self->label, $self->comment, $errors ); |
49
|
102
|
|
|
|
|
682
|
my $i = $self->mk_input( $w, { type => 'text', value => $value }, $errors ); |
50
|
102
|
|
|
|
|
561
|
my $e = $self->mk_error( $w, $errors ); |
51
|
|
|
|
|
|
|
|
52
|
102
|
|
|
|
|
691
|
return $self->container( { element => $i, error => $e, label => $l } ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SEE ALSO |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Sebastian Riedel, C |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 LICENSE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
66
|
|
|
|
|
|
|
the same terms as Perl itself. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |