From: ivan Date: Sat, 31 Jan 2004 05:15:54 +0000 (+0000) Subject: 0.03: add form_radio X-Git-Tag: HTML_Widgets_SelectLayers_0_03 X-Git-Url: http://git.freeside.biz/gitweb/?p=HTML-Widgets-SelectLayers.git;a=commitdiff_plain;h=532c143b7983613ddd89ee5a8626dbd375418a6e 0.03: add form_radio --- diff --git a/Changes b/Changes index 6a20749..0839e2f 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/README b/README index d684e7a..624c327 100644 --- a/README +++ b/README @@ -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!!; @@ -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"; } 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' => 'Download HTML-Widgets-SelectLayers-0.02.tar.gz', + 'download' => 'Download HTML-Widgets-SelectLayers-0.03.tar.gz', 'installation' => '
   perl Makefile.PL
@@ -38,8 +38,8 @@ as well as 
 'compatibility' => '
 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.
 
', );