X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=SelectLayers.pm;h=a50d96924e0306c1ee7b904725a817b6fb305c91;hb=532c143b7983613ddd89ee5a8626dbd375418a6e;hp=6acb19d7f8d64494a794990a90aa0d36c02846f8;hpb=e6055dffd01995988d3ca0e75adc58e1321561e8;p=HTML-Widgets-SelectLayers.git
diff --git a/SelectLayers.pm b/SelectLayers.pm
index 6acb19d..a50d969 100644
--- a/SelectLayers.pm
+++ b/SelectLayers.pm
@@ -3,7 +3,7 @@ package HTML::Widgets::SelectLayers;
use strict;
use vars qw($VERSION);
-$VERSION = '0.02';
+$VERSION = '0.03';
=head1 NAME
@@ -25,6 +25,8 @@ HTML::Widgets::SelectLayers - Perl extension for selectable HTML layers
'form_action' => 'process.cgi',
'form_text' => [ qw( textfield1 textfield2 ) ],
'form_checkbox' => [ qw( checkbox1 ) ],
+ 'form_radio' => [ qw( radio1 ) ],
+ 'form_select' => [ qw( select1 ) ],
'layer_callback' => sub {
my $layer = shift;
my $html = qq!!;
@@ -87,6 +89,9 @@ form_text - (optional) Array reference of text (or hidden) form fields to copy
form_checkbox - (optional) Array reference of checkbox form fields to copy from
the B form.
+form_radio - (optional) Array reference of radio form fields to copy from the
+ B form.
+
form_select - (optional) Array reference of select (not select multiple) form
fields to copy from the B form.
@@ -127,6 +132,8 @@ sub html {
exists($self->{form_text}) ? $self->{form_text} : [];
my $form_checkbox =
exists($self->{form_checkbox}) ? $self->{form_checkbox} : [];
+ my $form_radio =
+ exists($self->{form_radio}) ? $self->{form_radio} : [];
my $form_select =
exists($self->{form_select}) ? $self->{form_select} : [];
@@ -159,7 +166,8 @@ END
$html .= <
END
- foreach my $f ( @$form_text, @$form_checkbox, @$form_select ) {
+ foreach my $f ( @$form_text, @$form_checkbox, @$form_radio, @$form_select )
+ {
$html .= <
END
@@ -194,6 +202,8 @@ sub _fixup {
exists($self->{form_text}) ? $self->{form_text} : [];
my $form_checkbox =
exists($self->{form_checkbox}) ? $self->{form_checkbox} : [];
+ my $form_radio =
+ exists($self->{form_radio}) ? $self->{form_radio} : [];
my $form_select =
exists($self->{form_select}) ? $self->{form_select} : [];
my $html = "
@@ -214,6 +224,13 @@ sub _fixup {
what.$f.value = '';\n"
}
+ foreach my $f ( @$form_radio ) {
+ $html .= "what.$f.value = '';
+ for ( i=0; i< document.$form_name.$f.length; i++ )
+ if ( document.$form_name.${f}[i].checked )
+ what.$f.value = document.$form_name.${f}[i].value;\n";
+ }
+
foreach my $f ( @$form_select ) {
$html .= "what.$f.value = document.$form_name.$f.options[document.$form_name.$f.selectedIndex].value;\n";
}