HTML::DBForm::Search::TableList - Creates a web interface for searching database tables


    $search = HTML::DBForm::Search->new('tablelist', { column => 'name' });
    $editor->run(search => $search);


  HTML::DBForm::Search::TableList provides a web interface to search for rows
  in a database to be updated by HTML::DBForm. 



Constructor inherited from HTML::DBForm::Search

takes a scalar indicating the type of search module to create (in this case 'tablelist'), and a list of hash refs designating which columns to display as HTML select form elements, and in which order.

Each hash should have one of the following keys: 'column', 'columns', or 'sql'. 'column' should be the db column to search, 'columns' should be two db columns, the first of which will be the column to search, and the second of which will be the values to display as option labels. 'sql' can be used to populate the select options with an arbitrary SQL statement. If one column is returned from the SQL statement, then it will be used as choice values and labels. If two columns are returned, then the first will be the specified column value, while the second will be used as option labels.


    $search = HTML::DBForm::Search->new('tablelist',
        { column => 'category' },
        { columns => ['id', ' CONCAT(fname, ' ', lname) '] }


This would create a two step search, the first screen would be a selection of existing categories, and the next screen would be a selection of names within the chosen categories. When picking columns to display in the search, be aware that the final choice should result in the primary key being chosen.


    $search = HTML::DBForm::Search->new('tablelist',
        { sql => ['id','SELECT id, label FROM table ORDER BY label'] }

This would create a simple one step search.

You can use as many hashrefs as needed, each one will generate a new search step, (e.g three hash references will create a three step search). Just keep in mind that the last column chosen must be the column given to DBForm->new() as a primary key.


Sets an optional css file

Takes a scalar holding the path to a stylesheet.




Sets an optional template file

Takes a scalar holding the path to an HTML::Template template. To get a template file to start with, you can do this: perl -MHTML::DBForm::Search::DropDown -e 'print HTML::DBForm::Search::DropDown::TEMPLATE()' > sample.tmpl




Adds a new column to your search list table. Only affects the last search screen.

Required parameters:

column the column that this form element represents

Optional parameters:

label a label that will appear as the column header. this will default to the name of the column.

callback a subroutine reference that will be passed each value for processing before display.


    $editor->add_column( column => 'date' );
        column  => 'fname', 
        label   => 'First Name', 
        callback => sub { ucfirst(shift) }

1 POD Error

The following errors were encountered while parsing the POD:

Around line 35:

You forgot a '=back' before '=head2'