[Tutor] HTML form pre-populating functionality or hints on building
Thu Apr 17 13:37:39 2003
Scott Chapman wrote:
>I'm wanting to find (or make) a module that will take a HTML file, locate the
>input-related form tags (<INPUT, <TEXTAREA, <SELECT, <OPTION) and modify them
>by putting in values from a dictionary (i.e. pre-populate the form). I want a
>module that is implemented 100% in python and does _not_ use any special tags
>to do this (such as webware, albatross, spyce, etc.)
For simple HTML generation, you can look into the htmlgen module
it's a little dated, but should be able to handle basic needs like this.
You can use it to generate the appropriate HTML tag for that form
element, and then substitute your new element for the existing one.
In order to find the necessary tags, you can use one of the HTML parsers
that's already distributed with Python. Check out the htmllib and
I've never done HTML generation in Python myself, so I can't offer more
specific pointers, but hopefully this will be enough to get you started
in the right direction.