Francesc Guasch > HTML-Widgets-Search-0.07 > HTML::Widgets::Search

Download:
HTML-Widgets-Search-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.07   Source  

NAME ^

HTML::Widgets::Search - Perl module for building searches returning HTML

SYNOPSIS ^

    <%perl>
    use HTML::Widgets::Search;
    my $search=HTML::Widgets::Search->new(
               query => "SELECT idCustomer,name               ".
                        " FROM customers WHERE name LIKE 'a%' ".
                        " ORDER BY name                       ",
            field_id => "idCustomer",
               limit => 10,
         form_fields => \%ARGS,
                 dbh => $dbh
    );
    </%perl>

        <% $search->n_found %> customers found
        <% $search->current_start %> to <% $search -> current_end %><BR>

        <% $search->head %>
    <TABLE WIDTH="90%">
        <%perl>
             $search->render_table(
                 link=>"http://www.me.com/show_customer.html"
             );
        </%perl>
    </TABLE>

    <A HREF="search_customer.html<% $search->next %>">next</A>

    <A HREF="search_customer.html<% $search->prev %>">previous</A>

    <% $search->prev(submit => '<INPUT  TYPE="IMAGE" 
                                SRC="/img/prev.gif"  
                                NAME="previous" BORDER=0>')
        %>
    %#################################################################3
    <TABLE>
    % while (my @row=$search->fetchrow) {
        <TR><TD>
            <% join "</TD><TD>", @row %>
        </TD></TR>
    % }
    </TABLE>

DESCRIPTION ^

    The programmer designs a html form with some field values, then
    you can write a sql query using those fields.


        The constuctor requires a SQL statement and a valid DBI object.

    render_table returns a HTML table with the results , if a link
    is provided every field of the table has that link. If a field_id
        is provided the link adds that field as a parameter. This field
        must be the first field of the select query and is discarded in
        the render.

    Supports native mysql limit clauses. For other DBs skips untill start
    and fetches until limit.

        Give it a try, the synopsis may help you start.
        Let me know if it's useful for or whatever you want to tell me.

METHODS ^

TODO ^

    Improve the docs. You can help me !

AUTHOR ^

Francesc Guasch frankie@etsetb.upc.es

SEE ALSO ^

perl(1) , DBI.