Skip to main content
Inspiring
December 2, 2008
Question

Getting Data

  • December 2, 2008
  • 3 replies
  • 566 views
I have a page here that add rows with 3 textbox after pressing the button. The added textbox have all unique name. My question is how can I access the data on the added textbox in the next page if I don't know how many rows will be added?
This topic has been closed for replies.

3 replies

Inspiring
December 3, 2008
When you submit the form, there will be no array of textboxes unless you create one. I don't see that being necessary and the approach in my previous answer will work in your situation.
dchardAuthor
Inspiring
December 3, 2008
that's my javascript is doing....after you click the add order it will add another row with three textbox.....so basically after clicking the link it will also create an array of textbox
dchardAuthor
Inspiring
December 3, 2008
var oCell = newRow.insertCell(0);
oCell.height = '25';
oCell.vAlign = 'middle';
oCell.align = 'center';
oCell.style.background = '#EEEEEE';
oCell.innerHTML = "<input type='text' name='textfieldA[]' class='bodytext' size='20' align='center'>";

oCell = newRow.insertCell(1);
oCell.height = '25';
oCell.vAlign = 'middle';
oCell.align = 'center';
oCell.style.background = '#EEEEEE';
oCell.innerHTML = "<input type='text' name='textfieldB[]' class='bodytext' size='35' align='center'>";

oCell = newRow.insertCell(2);
oCell.height = '25';
oCell.vAlign = 'middle';
oCell.align = 'center';
oCell.style.background = '#EEEEEE';
oCell.innerHTML = "<input type='text' name='textfieldC[]' class='bodytext' size='3' align='center'>";

if I'm going to change the name of the textbox I'm going to add into an array. How can I access the data on each textbox on the nextpage?

Inspiring
December 2, 2008
Your code is unreadable so I'll just tell you how I do it.

On the form page, the fields will have names like text1, text2, etc.

On the action page, I do something like this.

<cfloop list="#form.fieldnames#" (or whatever the right name is) index ="ThisField">
<cfif left(ThisField, 4) is "text">
<cfset ThisID = removechars(ThisField, 4)>
<cfset ThisValue = form[ThisField]>

and then carry on with whatever you want to do.