GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::WIDGETS::SELECTLAYERS (3)

.ds Aq ’

NAME

HTML::Widgets::SelectLayers - Perl extension for selectable HTML layers

CONTENTS

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;



DESCRIPTION

This 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.).

FORMS

My 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 <B>form_B> options below.

METHODS

new KEY, VALUE, KEY, VALUE... Options are passed as name/value pairs:

options - Hash reference of layers and labels for the <SELECT>. See
Tie::IxHash to control ordering.
In HTML: <OPTION VALUE=$layer>$label</OPTION>

layer_callback - subroutine reference to create each layer. The layer name
is passed as an option in @_

selected_layer - (optional) initially selected layer

form_name - (optional) Form name to copy values from. If not supplied, no
values will be copied.

form_action - Form action

form_elements - (optional) Array reference of form fields to copy from the
<B>form_nameB> 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_nameB> form.

form_checkbox - (optional) Array reference of checkbox form fields to copy from
the <B>form_nameB> form.

form_radio - (optional) Array reference of radio form fields to copy from the
<B>form_nameB> form.

form_select - (optional) Array reference of select form fields to copy from
the <B>form_nameB> form.

fixup_callback - (optional) subroutine reference, returns supplimentary
JavaScript for the function described above under FORMS.

size - (optional) size of the <SELECT>, default 1.

unique_key - (optional) prepended to all JavaScript function/variable/object
names to avoid namespace collisions.

html_beween - (optional) HTML between the <SELECT> and the layers.

under_position - (optional) specifies the positioning of any HTML appearing after the widget. static, the default, positions subsequent HTML underneath the current layer (or immediately under the select box if no layer has yet been selected), reflowing when layers are changed. absolute calculates the size of the largest layer and keeps the subsequent HTML in a single position underneath it. Note that absolute works by positioning subsequent HTML in a <DIV>, so you should probably close it yourself with a </DIV> before your </HTML> end tag. absolute is a bit experimental and might have some quirks with truncating the end of the page under IE; you might have better results by just making all your layers the exact same size at the moment.

html Returns HTML for the widget.

AUTHOR

Ivan Kohler <ivan-selectlayers@420.am>

COPYRIGHT

Copyright (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.

BUGS

JavaScript

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 ALSO

perl. Tie::IxHash, http://www.xs4all.nl/~ppk/js/dom.html, http://javascript.about.com/library/scripts/blsafeonload.htm

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 132: =cut found outside a pod block. Skipping to next block.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SELECTLAYERS (3) 2007-02-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.