Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
I'm trying to create a code generator, but I'm having problems storing the information, because part of it is a table, and there is no way of knowing how many fields will be needed. Anyway, what I need to do is create a number of hidden fields to store the information, then get it when everything is done.

Right now, I'm just doing


for(i=0; i<cols; i++) {
// Input stuff here
document.write('<input type="hidden" name="name" value="stuff_entered' + i + '" />';
}


Then, in the next step (this is all one page, with a js function switching between what <div> section is visible), it will need to get the information to create the code. I tried using this:


for(i=0; i<document.formName.stuff_entered.value; i++) {
// Code to write out the code
}


When I try that, I get an error saying that document.formName.stuff_entered has no properties. Anyone have any suggestions about how to get around that?



Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
var i = 0;
while(document.formName["stuff_entered"+i]){
alert(document.formName["stuff_entered"+i].value);
i++;
}

newBookmarkLockedFalling