[thelist] Javascript orderform speed issue

Matt Warden mwarden at gmail.com
Sun Mar 5 18:51:11 CST 2006

Hash: SHA1

Rory Lysaght wrote:
> Matt,
>   Thanks.  You were right - I don't need to cycle through the entire
> form every single time.  I just check the changed field and add it to
> the subtotal.  Script zips along now in Firefox and IE.
> EXCEPT for one situation:  if someone enters a bunch of items, then
> goes back and deletes a previously entered number, the script has no
> way to tell what quantity was just deleted and to update the total. 
> So in this case, I need to recalculate the entire form again.  I moved
> my old loop out into a function, so I only need to run it in this
> case, but then I'm back to glacial performance in IE.

You still need only compute the values in the fields in the touched
object. There is not a case that I can think of where you need to loop
through every input field, unless fields have starting values whe the
page is loaded (even then, you could get around it).

- --
Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the thelist mailing list