diff options
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | SelectLayers.pm | 21 | ||||
-rwxr-xr-x | homepage.pl | 6 |
4 files changed, 28 insertions, 8 deletions
@@ -1,5 +1,8 @@ Revision history for Perl extension HTML::Widgets::SelectLayers. +0.03 Fri Jan 30 20:51:14 2004 + - add form_radio + 0.02 Thu May 9 03:05:15 2002 - enable form_select @@ -7,8 +7,8 @@ see http://www.420.am/selectlayers/ This HTML generated by this module uses JavaScript, but nevertheless attempts to be as cross-browser as possible, testing for features via DOM support rather -than specific browsers or versions. It has been tested under Mozilla 0.9.8 and -1.0rc1, Netscape 4.77, IE 5.5, Konqueror 2.2.2, and Opera 5.0. +than specific browsers or versions. It has been tested under Mozilla +0.9.8->1.4, Netscape 4.77, IE 5.5, Konqueror 2.2.2->3.1.5, and Opera 5.0. INSTALLATION @@ -21,7 +21,7 @@ To install this module type the following: COPYRIGHT AND LICENCE -Copyright (c) 2002 Ivan Kohler +Copyright (c) 2004 Ivan Kohler All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 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!<INPUT TYPE="hidden" NAME="layer" VALUE="$layer">!; @@ -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_name> form. +form_radio - (optional) Array reference of radio form fields to copy from the + B<form_name> form. + form_select - (optional) Array reference of select (not select multiple) form fields to copy from the B<form_name> 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; <FORM NAME="${key}$layer" ACTION="$form_action" METHOD=POST onSubmit="${key}fixup(this)"> END - foreach my $f ( @$form_text, @$form_checkbox, @$form_select ) { + foreach my $f ( @$form_text, @$form_checkbox, @$form_radio, @$form_select ) + { $html .= <<END; <INPUT TYPE="hidden" NAME="$f" VALUE=""> 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"; } diff --git a/homepage.pl b/homepage.pl index 765ec18..57c47c0 100755 --- a/homepage.pl +++ b/homepage.pl @@ -14,7 +14,7 @@ tie my %o, 'Tie::IxHash', my %html = ( - 'download' => '<A HREF="HTML-Widgets-SelectLayers-0.02.tar.gz">Download HTML-Widgets-SelectLayers-0.02.tar.gz</a>', + 'download' => '<A HREF="HTML-Widgets-SelectLayers-0.03.tar.gz">Download HTML-Widgets-SelectLayers-0.03.tar.gz</a>', 'installation' => '<PRE> perl Makefile.PL @@ -38,8 +38,8 @@ as well as <A HREF="http://www.420.am/cgi-bin/cvsweb/HTML-Widgets-SelectLayers"> 'compatibility' => '<PRE> This HTML generated by this module uses JavaScript, but nevertheless attempts to be as cross-browser as possible, testing for features via DOM support rather -than specific browsers or versions. It has been tested under Mozilla 0.9.8, -Netscape 4.77, IE 5.5, Konqueror 2.2.2, and Opera 5.0. +than specific browsers or versions. It has been tested under Mozilla +0.9.8->1.4, Netscape 4.77, IE 5.5, Konqueror 2.2.2->3.1.5, and Opera 5.0. </PRE>', ); |