Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic form variables 2

Status
Not open for further replies.

jl8789

MIS
May 22, 2003
293
0
0
US
How do I get the value of dynamic form variables?
I thought it was:
function doThis(i){
d = document.ctrlPage["wiringDepthInq" + i];

d.value;
}
But I keep getting error that value is null or not an object!?
 
Rather than type it all back out, here's all the info you need:


thread216-1432657


I really should just make a FAQ....

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
I guess I'm having issues with trying to access the form variable depthInq1 or depthInq2 by passing that number in to the function:
It is telling me it is null or not an object, when it isnt.
I've tried,
function doThis(i){
a = document.forms["ctrlPage"].elements["depthInq"+"i"];
}

a = document.getElementById(depthInq+"i")
a = document.getElementById("depthInq"+i)
I just want to assign the variables to the objects, then refer to the values later...

 
Try using:
Code:
function doThis(i){
d = document.forms['ctrlPage'].elements["wiringDepthInq" + i];
alert(d.value);
}

Lee
 
Thanks for the replies. Of course it was something else, I had a similar field named the same further in the form...then of course it is undefined.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top