[thelist] Hidden Fields

Liz Lawson lizlawson at charitycards.co.uk
Thu Jul 13 03:46:50 CDT 2000


(Regarding hidden fields in forms)
> Yeah (kind of). I understand now how it works but I can't see why
> I would want to use it.


two reasons: 1, covered by many people already, is that you may have
information which is specific to that user at that time, but they do not
need to edit (eg this user came from the music page, that user has session
ID u4c2irlig2liu6brcx72trcx.)

2. so you can reuse the same scipt for different forms: Here's quick and
very widely used example:

have a look at the source code of some pages which have a mail form. Very
often, you'll see that the source code has hidden fields for the "to"
address and subject. Why put the e-mail address in the form? I mean, it's
unlikely to change, right? Well, it means that you can use the same mail
script as the action for a lot of different forms going to different
addresses about different subjects, because the script pulls that
information from the form input rather than it being hard coded. After all,
who wants be bothered with seven versions of the same script, identical
except for an e-mail address?

Hidden fields are one of the reasons there are so many "generic" scripts
available for people who can't/don't want to write their own: you can set
the configuration options as hidden fields in the HTML rather than having to
edit the script itself beyond setting it up for your server.



Liz






More information about the thelist mailing list