[thelist] Why are these objects undefined????

Jeff Howden jeff at jeffhowden.com
Thu Aug 14 18:41:14 CDT 2003


> From: Steve Abaffy
> function MoveQuantityUp(HiddenName,productID){
> 	HTMLName = eval("document.frm.DV" + HiddenName);
> 	HiddenName = eval("document.frm.HV" + HiddenName);
> 	TAH = eval("document.frm.TAH" + productID);
> 	TA = eval("document.frm.TA" + productID);
> }
> Now here HTMLName is undefined
> HiddenName is ok and I can work with it
> TAH is ok and I can work with it
> TA is undefined

first off, using eval() is making this really difficult to debug, let alone
and make any sense of.  instead, use the forms and elements arrays for what
they were designed to do.

HTMLName = document.forms['frm'].elements['DV' + HiddenName];
HiddenName = document.forms['frm'].elements['HV' + HiddenName];
TAH = document.forms['frm'].elements['TAH' + ProductID];
TA = document.forms['frm'].elements['TA' + ProductID];

second, did you intend to reset the HiddenName argument with another value?

now, on to the actual error. start by using an alert(), just before the line
that's erroring to see what "'TA' + ProductID" is.

alert('TA' + ProductID);

next, look to see if that form field is in the form or not.  if it is, it
shouldn't be throwing an error like that.

good luck,


Jeff Howden - Web Application Specialist
Résumé - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/

More information about the thelist mailing list