line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::JavaScript::Result;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'HTML::Widget::Result';
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
764
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_attr_accessors(qw/onsubmit/);
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
HTML::Widget::JavaScript::Result - Result Class which supports JavaScript parameter validation
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.02
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module adds the ability to output JavaScript validation code to
|
24
|
|
|
|
|
|
|
L.
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 FUNCTIONS
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
See L.
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 $self->as_xml
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Returns the widget's XML representation, including JavaScript validation code.
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub as_xml {
|
39
|
|
|
|
|
|
|
my $self = shift;
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $id = $self->name;
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# stop function taken from prototype.js
|
44
|
|
|
|
|
|
|
my $js_code = <
|
45
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
EOJS
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$self->onsubmit("__html__widget__validate__$id(event)");
|
79
|
|
|
|
|
|
|
return $js_code . $self->SUPER::as_xml;
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Nilson Santos Figueiredo Júnior, C<< >>
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 BUGS
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Please report any bugs or feature requests directly to the author.
|
89
|
|
|
|
|
|
|
If you ask nicely it will probably get fixed or implemented.
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Copyright 2006, 2009 Nilson Santos Figueiredo Júnior, all rights reserved.
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
96
|
|
|
|
|
|
|
under the same terms as Perl itself.
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; # End of HTML::Widget::JavaScript::Result
|