X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=SelectLayers.pm;h=54440719de65c43afa40a5092c9f2d1e74056665;hb=c596647a05d29ca82878b47dbc78112916c19950;hp=f37c90aae765403ef6e56d421f0ba237f8fc5a07;hpb=f1b912124552474bb635f697e1a6fd34f2ddb40d;p=HTML-Widgets-SelectLayers.git
diff --git a/SelectLayers.pm b/SelectLayers.pm
index f37c90a..5444071 100644
--- a/SelectLayers.pm
+++ b/SelectLayers.pm
@@ -3,7 +3,7 @@ package HTML::Widgets::SelectLayers;
use strict;
use vars qw($VERSION);
-$VERSION = '0.05';
+$VERSION = '0.07';
=head1 NAME
@@ -23,10 +23,17 @@ HTML::Widgets::SelectLayers - Perl extension for selectable HTML layers
'options' => \%options,
'form_name' => 'dummy',
'form_action' => 'process.cgi',
- 'form_text' => [ qw( textfield1 textfield2 ) ],
- 'form_checkbox' => [ qw( checkbox1 ) ],
- 'form_radio' => [ qw( radio1 ) ],
- 'form_select' => [ qw( select1 ) ],
+
+ #new code auto-detects form types (radio not yet supported)
+ #'form_elements' => [ qw( textfield1 textfield2 checkbox1 radio1 select1 ) ],
+ 'form_elements' => [ qw( textfield1 textfield2 checkbox1 radio1 select1 ) ],
+
+ #deprecated style still works for now
+ #'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!!;
@@ -50,7 +57,8 @@ example see http://www.420.am/selectlayers/
This HTML generated by this module uses JavaScript, but nevertheless attempts
to be as cross-browser as possible. The 0.05 release drops Navigator 4
compatibility and has been tested under Mozilla Firefox 1.0.6, MSIE 6.0,
-Konqueror 3.3.2, and Opera 8.0.2.
+Konqueror 3.3.2, and Opera 8.0.2 (2006 note: still working under newer
+browsers such as IE7, Firefox 2.0, etc.).
=head1 FORMS
@@ -83,6 +91,11 @@ form_name - (optional) Form name to copy values from. If not supplied, no
form_action - Form action
+form_elements - (optional) Array reference of form fields to copy from the
+ B form. Field type is autodetected; currently
+ text, hidden, checkbox, and select fields are
+ supported. Radio fields are not yet supported.
+
form_text - (optional) Array reference of text (or hidden) form fields to copy
from the B form.
@@ -92,8 +105,8 @@ form_checkbox - (optional) Array reference of checkbox form fields to copy from
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.
+form_select - (optional) Array reference of select form fields to copy from
+ the B form.
fixup_callback - (optional) subroutine reference, returns supplimentary
JavaScript for the function described above under FORMS.
@@ -130,6 +143,9 @@ sub html {
my $between = exists($self->{html_between}) ? $self->{html_between} : '';
my $options = $self->{options};
my $form_action = exists($self->{form_action}) ? $self->{form_action} : '';
+
+ my $form_elements =
+ exists($self->{form_elements}) ? $self->{form_elements} : [];
my $form_text =
exists($self->{form_text}) ? $self->{form_text} : [];
my $form_checkbox =
@@ -167,9 +183,9 @@ END
#form fields
$html .= <
+