HTML::FormHighlight - Highlights fields in an HTML form.


NAME

HTML::FormHighlight - Highlights fields in an HTML form.


SYNOPSIS

    use HTML::FormHighlight;
    my $h = new HTML::FormHighlight;
    print $h->highlight(
        scalarref => \$form,
        fields    => [ 'A', 'B', 'C' ],
    );
    print $h->highlight(
        scalarref    => \$form,
        fields       => [ 'A', 'B', 'C' ],
        highlight    => '*',
        mark         => '<!-- HIGHLIGHT HERE -->',
        all_in_group => 1,
    );


DESCRIPTION

HTML::FormHighlight can be used to highlight fields in an HTML form. It uses HTML::Parser to parse the HTML form, and then places text somewhere before each field to highlight the field. You can specify which fields to highlight, and optionally supply a CGI object for it to check whether or not an input value exists before highlighting the field.

It can be used when displaying forms where a user hasn't filled out a required field. The indicator can make it easier for a user to locate the fields that they've missed. If you're interested in more advanced form validation, see the HTML::FormValidator manpage. the HTML::FillInForm manpage can also be used to fill form fields with values that have already been submitted.


METHODS

new()

    Create a new HTML::FormHighlight object.  Example:
        $h = new HTML::FormHighlight;

highlight()

Parse through the HTML form and highlight fields. The method returns a scalar containing the parsed form. Here are a few examples:

    To highlight the fields 'A', 'B' and 'C' (form on disk):
        $h->highlight(
            file   => 'form.html',
            fields => [ 'A', 'B', 'C' ],
        );
    To highlight the fields 'A' and 'B' with a smiley face
    (form as a scalar):
        $h->highlight(
            scalarref => \$form,
            fields    => [ 'A', 'B' ],
            highlight => '<img src="smiley.jpg">',
        );
    To highlight the fields 'A' and 'B' if they haven't been supplied
    by form input (form as an array of lines):
        $q = new CGI;
        $h->highlight(
            arrayref => \@form,
            fields  => [ 'A', 'B' ],
            fobject => $q,
        );

Note: highlight() will only highlight the first option in a radio or select group unless the all_in_group flag is set to a true value.

Here's a list of possible parameters for highlight() and their descriptions:


BUGS


VERSION

0.03


AUTHOR

Adekunle Olonoh, ade@bottledsoftware.com


CREDITS

Hiroki Chalfant


COPYRIGHT

Copyright (c) 2000 Adekunle Olonoh. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


SEE ALSO

the HTML::Parser manpage, the CGI manpage, the HTML::FormValidator manpage, the HTML::FillInForm manpage

 HTML::FormHighlight - Highlights fields in an HTML form.