[thelist] Hidden Fields - be careful

Peter Barrett peterb at corel.com
Thu Jul 13 09:10:52 CDT 2000


One important thing to remember when using hidden forms for persistent
data storage:

    In Netscape, if you resize a window it gets reloaded. This is
important because any client-side state is wiped out (ie. if you've
generated some values for your hidden fields from user actions via
javascript).

   An 'onload' on the page can reset defaults via some sort of init()
function, and server-side script is not affected (ie. <%= foo %> will be
reloaded with the page), but there's no way that I know to keep the
client side javascript generated info, short of stuffing into an applet.

cheers!
~pete

Palyne Gaenir wrote:

> On 12 Jul 2000, at 22:36, kev.skindrill wrote:
> (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.
>
> If you do many forms, and especially dynamic sites (other than very
> simple shopping), you'll likely need to use hidden fields constantly.
> So it's worth understanding.
>
> The examples used related to multi-page forms.  That's a common use
> for them.  Handy even on single-page forms where you want the visitor
> to have a full-page display after entry to proof and then 'confirm'
> before submitting.  But at least in my case (cfml work), mainly I
> have to use them in data entry forms (single page).  Many forms are
> long.  The user does not need to know the record ID in the system,
> the many options that only the admins can change/set, etc. and I
> don't want it on the screen, so the fields are hidden.
>
> In some cases, similar to the example given on ASP elsewhere, you
> might just be auto-setting "what/where" data belongs, so that when a
> person goes to a (even single page) form, that data is encoded.  If I
> have a page related to 'martial arts' and you can add your article or
> link to it, when you click on the button to 'add new X', it's going
> to pass the values that tell the system, "this belongs to the martial
> arts section."  When your form comes up, that value will probably be
> hidden; you don't need to know.
>
> I use hidden fields when for security reasons I don't want to pass
> values on the URL.  Sometimes I duplicate the values on the URL
> simply because the client wants a given page to be bookmarkable.
>
> In dynamic work you often use more than one db table and that brings
> up a whole host of values that often need to be passed to relate data
> from one application table to another.
>
> The best way to learn about the logic behind things, why they're
> useful, and how to use them, is to actually MAKE something.  Find
> something you're interested in that could be databased -- even in a
> flat file -- and make yourself a little app for it.  Categorize and
> list your refrigerator contents, I don't know, everybody has got
> something they're interested in (one hopes).
>
> I learned stuff that way.  I was a warehouse mgr, couldn't imagine
> sitting for a living (ha) and after a vacation went home and worked
> temp; this guy wanted me to take a job and I said, if you buy me this
> and that (computer stuff) so I can learn.  He did, and I spent eons
> of personal time typing in (and then databasing) my 400-odd songs and
> poems (word processing), my personal budget (spreadsheet), etc.  Then
> I was bored with filling out these forms at work so I made macros in
> my spreadsheet to auto calculate all kinds of numbers for inventory
> control and sales stats etc. so I didn't have to do so much work on
> them. Ended up getting all kinds of stuff adopted by corporate -- by
> the time I got computer training I knew more than the teachers ever
> seemed to, and ended up teaching software myself later.  Ironic end
> to the story: After about 14 months of working 40 hrs plus nearly
> that on my own time, I had touched and reorganized probably millions
> of papers in the office, built all kinds of neat little systems, and
> had maybe 1.5 hours of work to do a day.  Ended up leaving to become
> a troubleshooter because I was bored out of my mind.  Automated
> myself right out of a job, I did. :-)  In a perfect world, as a
> webmaster, you can automate yourself into making money and having a
> life at the same time.
>
> I'm still working on the last part...
>
> You gotta start somewhere.  If you can't see the value of XYZ (and I
> understand that perfectly), do some more of whatever it is that seems
> to make people want to use XYZ, and you'll probably figure out why.
>
> Palyne
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list