CGI::Form::Table

CGI::Form::Table is a Perl module that allows you to create a table of form inputs.
Download

CGI::Form::Table Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ricardo Signes
  • Publisher web site:
  • http://search.cpan.org/~rjbs/

CGI::Form::Table Tags


CGI::Form::Table Description

CGI::Form::Table is a Perl module that allows you to create a table of form inputs. CGI::Form::Table is a Perl module that allows you to create a table of form inputs.SYNOPSIS use CGI::Form::Table; my $form = CGI::Form::Table->new( prefix => 'employee', columns => ); print $form->as_html; print $form->javascript;This module simplifies the creation of an HTML table containing form inputs. The table can be extended to include extra rows, and these rows can be removed. Each has a unique name, and on form submission the inputs are effectively serialized.CGI::Form::Table::Reader will use the CGI module to produce a data structure based on the parameters submitted by a form of this type.METHODSCGI::Form::Table->new(%arg)This method constructs a new form. The only required arguments are columns, which names the columns that will be in the form table, and prefix, which gives the unique prefix for input fields.If given, initial_rows specifies how many rows should initially be in the form.Instead of initial_rows, you can pass initial_values, a reference to an array of hashes providing values for the columns of each row. For example: my $table = CGI::Form::Table->new( prefix => "charsheet", columns => , initial_values => );column_header, if passed, is a hash of text strings to use as column headers. The keys are column names. Columns without column_header entries are headed by their names.Another argument, column_content, may be passed. It must contain a hashref, with entries providing subs to produce initial content. The subs are passed the form object, the row number, and the name of the column. For example, to add a reminder of the current row in the middle of each row, you might create a form like this: my $form = CGI::Form::Table->new( prefix => 'simpleform', columns => , column_content => { reminder => sub { $_ } } );This can be useful for forms that require SELECT elements or other complicated parts. (The JavaScript will just copy the column value when new rows are added, updating the name attribute.)$form->as_htmlThis returns HTML representing the form object. JavaScript is required to make the form expandible/shrinkable; see the javascript method. ("SEE ALSO")$form->column_header($column_name)This method returns the text that should be used as the column header in the table output. If no header was given in the initialization of the form, the column name is returned verbatim. (No checking is done to ensure that the named column actually exists.)$form->cell_content($row, $column_name)This method returns the text (HTML) that should appear in the given row and column. If no column_content entry was given for the column, a basic input element is generated.$form->cell_value($row, $column_name)This method returns the default value for the given row and column, taken from the initial_values passed to the initializer.$class->javascriptThis method returns JavaScript that will make the handlers for the HTML buttons work. This code has been (poorly) tested in Firefox, MSIE, and WebKit-based browsers. Requirements: · Perl


CGI::Form::Table Related Software