{
    "mode": "perldoc",
    "parameter": "HTML::FillInForm",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/HTML%3A%3AFillInForm/json",
    "generated": "2026-06-12T15:04:02Z",
    "synopsis": "Fill HTML form with data.\n$output = HTML::FillInForm->fill( \\$html,   $q );\n$output = HTML::FillInForm->fill( \\@html,   [$q1,$q2] );\n$output = HTML::FillInForm->fill( \\*HTML,   \\%data );\n$output = HTML::FillInForm->fill( 't.html', [\\%data1,%data2] );\nThe HTML can be provided as a scalarref, arrayref, filehandle or file. The data can come from\none or more hashrefs, or objects which support a param() method, like CGI.pm, Apache::Request,\netc.",
    "sections": {
        "NAME": {
            "content": "HTML::FillInForm - Populates HTML Forms with data.\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.22\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "Fill HTML form with data.\n\n$output = HTML::FillInForm->fill( \\$html,   $q );\n$output = HTML::FillInForm->fill( \\@html,   [$q1,$q2] );\n$output = HTML::FillInForm->fill( \\*HTML,   \\%data );\n$output = HTML::FillInForm->fill( 't.html', [\\%data1,%data2] );\n\nThe HTML can be provided as a scalarref, arrayref, filehandle or file. The data can come from\none or more hashrefs, or objects which support a param() method, like CGI.pm, Apache::Request,\netc.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module fills in an HTML form with data from a Perl data structure, allowing you to keep the\nHTML and Perl separate.\n\nHere are two common use cases:\n\n1. A user submits an HTML form without filling out a required field. You want to redisplay the\nform with all the previous data in it, to make it easy for the user to see and correct the\nerror.\n\n2. You have just retrieved a record from a database and need to display it in an HTML form.\n\nfill\nThe basic syntax is seen above the Synopsis. There are a few additional options.\n",
            "subsections": [
                {
                    "name": "Options",
                    "content": "target => 'form1'\nSuppose you have multiple forms in a html file and only want to fill in one.\n\n$output = HTML::FillInForm->fill(\\$html, $q, target => 'form1');\n\nThis will fill in only the form inside\n\n<FORM name=\"form1\"> ... </FORM>\n\nfillpassword => 0\nPasswords are filled in by default. To disable:\n\nfillpassword => 0\n\nignorefields => []\nTo disable the filling of some fields:\n\nignorefields => ['prev','next']\n\ndisablefields => []\nTo disable fields from being edited:\n\ndisablefields => [ 'uid', 'gid' ]\n\ninvalidfields => []\nTo mark fields as being invalid (CSS class set to \"invalid\" or whatever you set invalidclass\nto):\n\ninvalidfields => [ 'uid', 'gid' ]\n\ninvalidclass => \"invalid\"\nThe CSS class which will be used to mark fields invalid. Defaults to \"invalid\".\n\nclearabsentcheckboxes => 0\nAbsent fields are not cleared or in any way changed. This is not what you want when you deal\nwith checkboxes which are not sent by browser at all when cleared by user.\n\nTo remove \"checked\" attribute from checkboxes and radio buttons and attribute \"selected\" from\noptions of select lists for which there's no data:\n\nclearabsentcheckboxes => 1\n"
                },
                {
                    "name": "File Upload fields",
                    "content": "File upload fields cannot be supported directly. Workarounds include asking the user to\nre-attach any file uploads or fancy server-side storage and referencing. You are on your own.\n"
                },
                {
                    "name": "Clearing Fields",
                    "content": "Fields are cleared if you set their value to an empty string or empty arrayref but not undef:\n\n# this will leave the form element foo untouched\nHTML::FillInForm->fill(\\$html, { foo => undef });\n\n# this will set clear the form element foo\nHTML::FillInForm->fill(\\$html, { foo => \"\" });\n\nIt has been suggested to add a option to change the behavior so that undef values will clear the\nform elements. Patches welcome.\n\nYou can also use \"clearabsentcheckboxes\" option to clear checkboxes, radio buttons and selects\nwithout corresponding keys in the data:\n\n# this will set clear the form element foo (and all others except\n# bar)\nHTML::FillInForm->fill(\\$html, { bar => 123 },\nclearabsentcheckboxes => 1);\n"
                }
            ]
        },
        "Old syntax": {
            "content": "You probably need to read no further. The remaining docs concern the 1.x era syntax, which is\nstill supported.\n\nnew\nCall \"new()\" to create a new FillInForm object:\n\n$fif = HTML::FillInForm->new;\n$fif->fill(...);\n\nIn theory, there is a slight performance benefit to calling \"new()\" before \"fill()\" if you make\nmultiple calls to \"fill()\" before you destroy the object. Benchmark before optimizing.\n\nfill ( old syntax )\nInstead of having your HTML and data types auto-detected, you can declare them explicitly in\nyour call to \"fill()\":\n\nHTML source options:\n\narrayref  => @html\nscalarref => $html\nfile      => \\*HTML\nfile      => 't.html'\n\nFill Data options:\n\nfobject   => $dataobj  # with param() method\nfdat      => \\%data\n\nAdditional methods are also available:\n\nfillfile(\\*HTML,...);\nfillfile('t.html',...);\nfillarrayref(\\@html,...);\nfillscalarref(\\$html,...);\n",
            "subsections": []
        },
        "USING AN ALTERNATE PARSER": {
            "content": "It's possible to use an alternate parser to HTML::Parser if the alternate provides a\nsufficiently compatible interface. For example, when a Pure Perl implementation of HTML::Parser\nappears, it could be used for portability. The syntax is simply to provide a \"parserclass\" to",
            "subsections": [
                {
                    "name": "new",
                    "content": "HTML::FillInForm->new( parserclass => 'MyAlternate::Parser' );\n"
                }
            ]
        },
        "CALLING FROM OTHER MODULES": {
            "content": "",
            "subsections": [
                {
                    "name": "Apache::PageKit",
                    "content": "To use HTML::FillInForm in Apache::PageKit is easy. It is automatically called for any page that\nincludes a <form> tag. It can be turned on or off by using the \"fillinform\" configuration\noption.\n"
                },
                {
                    "name": "Apache::ASP v2.09 and above",
                    "content": "HTML::FillInForm is now integrated with Apache::ASP. To activate, use\n\nPerlSetVar FormFill 1\n$Response->{FormFill} = 1\n\nHTML::Mason\nUsing HTML::FillInForm from HTML::Mason is covered in the FAQ on the masonhq.com website at\n<http://www.masonhq.com/?FAQ:HTTPAndHTML#h-howcanipopulateformvaluesautomatically>\n"
                }
            ]
        },
        "SECURITY": {
            "content": "Note that you might want to think about caching issues if you have password fields on your page.\nThere is a discussion of this issue at\n\nhttp://www.perlmonks.org/index.pl?nodeid=70482\n\nIn summary, some browsers will cache the output of CGI scripts, and you can control this by\nsetting the Expires header. For example, use \"-expires\" in CGI.pm or set \"browsercache\" to *no*\nin Config.xml file of Apache::PageKit.\n",
            "subsections": []
        },
        "TRANSLATION": {
            "content": "Kato Atsushi has translated these docs into Japanese, available from\n\nhttp://perldoc.jp\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please submit any bug reports to tjmather@maxmind.com.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "Requires Perl 5.005 and HTML::Parser version 3.26.\n\nI wrote this module because I wanted to be able to insert CGI data into HTML forms, but without\ncombining the HTML and Perl code. CGI.pm and Embperl allow you so insert CGI data into forms,\nbut require that you mix HTML with Perl.\n\nThere is a nice review of the module available here:\n<http://www.perlmonks.org/index.pl?nodeid=274534>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "HTML::Parser, Data::FormValidator, HTML::Template, Apache::PageKit\n",
            "subsections": []
        },
        "CREDITS": {
            "content": "Fixes, Bug Reports, Docs have been generously provided by:\n\nAlex Kapranoff                Miika Pekkarinen\nMichael Fisher                Sam Tregar\nTatsuhiko Miyagawa            Joseph Yanni\nBoris Zentner                 Philip Mak\nDave Rolsky                   Jost Krieger\nPatrick Michael Kane          Gabriel Burka\nAde Olonoh                    Bill Moseley\nTom Lancaster                 James Tolley\nMartin H Sluka                Dan Kubb\nMark Stosberg                 Alexander Hartmaier\nJonathan Swartz               Paul Miller\nTrevor Schellhorn             Anthony Ettinger\nJim Miner                     Simon P. Ditner\nPaul Lindner                  Michael Peters\nMaurice Aubrey                Trevor Schellhorn\nAndrew Creer\n\nThanks!\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "TJ Mather, tjmather@maxmind.com\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2000 by TJ Mather, tjmather@maxmind.com.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "HTML::FillInForm - Populates HTML Forms with data.",
    "flags": [],
    "examples": [],
    "see_also": []
}