|
NAMEHTML::Widgets::SelectLayers - Perl extension for selectable HTML layers SYNOPSIS use HTML::Widgets::SelectLayers;
use Tie::IxHash;
tie my %options, 'Tie::IxHash',
'value' => 'Select One',
'value2' => 'Select Two',
;
$widget = new HTML::Widgets::SelectLayers(
'options' => \%options,
'form_name' => 'dummy',
'form_action' => 'process.cgi',
#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!<INPUT TYPE="hidden" NAME="layer" VALUE="$layer">!;
$html .= $other_stuff;
$html;
},
);
print '<FORM NAME=dummy STYLE="margin-top: 0; margin-bottom: 0">'.
'<INPUT TYPE="text" NAME="textfield1">'.
'<INPUT TYPE="text" NAME="textfield2">'.
'<INPUT TYPE="checkbox" NAME="checkbox1" VALUE="Y">'.
$widget->html;
DESCRIPTIONThis module implements an HTML widget with multiple layers. Only one layer is visible at any given time, controlled by a <SELECT> box. For an 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 (2006 note: still working under newer browsers such as IE7, Firefox 2.0, etc.). FORMSMy understanding is that forms cannot span <DIV>s elements. The generated HTML will have a </FORM> tag before the layers and will generate <FORM> and </FORM> tags for each layer. To facilitate <SUBMIT> buttons located within the layers, you can pass a form name and element names, and the relevant values will be copied to the layer's form. See the form_ options below. METHODS
AUTHORIvan Kohler <ivan-selectlayers@420.am> COPYRIGHTCopyright (c) 2002-2005 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. BUGSJavaScript All the different form_* options are unnecessary, could use .type to auto-sense Could give you a function or something for copying variables out of the layered forms. SEE ALSOperl. Tie::IxHash, http://www.xs4all.nl/~ppk/js/dom.html, http://javascript.about.com/library/scripts/blsafeonload.htm POD ERRORSHey! The above document had some coding errors, which are explained below:
|