HTML form pre-populating functionality or hints on building my own

Adam Vandenberg adamv at
Thu Apr 17 10:47:18 CEST 2003

> I'm wanting to find (or make) a module that will take a HTML file, locate
> input-related form tags (<INPUT, <TEXTAREA, <SELECT, <OPTION) and modify

Here's a sample that parses some HTML and handles some form elements,
refilling them on POST-back:
(Source: )

But unfortunately... it uses "special tags" for the forms (the t.whatever
It would probably be easy enough to modify it to look for the regular form
tag names instead.
I specifically went with special tags because I wanted to abstract a control
from the HTML used to implement it.

I'm using the standard module sgmllib as the parser. Feel free to take the
code and run with it.
(Note that production could will want to be a lot more thorough about
cgi.escape'ing data that's taken from the form and written back out to the

Take care,
Adam Vandenberg

More information about the Python-list mailing list