Chewie71 Posted March 28, 2006 Share Posted March 28, 2006 I've been implementing some AJAX/Javascript and have been playing around with some dynamic forms. I'm using AJAX so that when a user enters data into a textbox, AJAX validates that data and then creates a new textbox so they can enter more data to be validated. I'm trying to figure out how to get javascript to read back the values from an unknown number of these textboxes. There may be one...there may be five...The textbox code looks something like this...[code]<input type=text name='cd0' onblur='populateSections(document.forms[\"adminForm\"], this.value, \"user\");'><input type=text name='cd1' onblur='populateSections(document.forms[\"adminForm\"], this.value, \"user\");'><input type=text name='cdn' onblur='populateSections(document.forms[\"adminForm\"], this.value, \"user\");'>[/code]I want to be able to read in an 'n' number of values from textboxes named 'cd1' through 'cdn'. Something like this...[code]x=0;while (document.myFormName.cdx){ readData = document.myFormName.cdx.value; //Do some AJAX stuff with the readData (rebuild the textboxes and add a new empty textbox with name="cdx+1" x++; //Go around again and read the next textbox value if there is one}[/code]I know this doesn't work, and I can't seem to find anyplace that says how to make this work. Is anyone else doing something like this?Thanks,Matt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.