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 fields not passing 1

Status
Not open for further replies.

clflyer

Programmer
Nov 26, 2002
6
0
0
US
I have a rather simple page and I can't get it to pass the dynamic fields that I add using the add button. When I submit it, I only get the fields that are hard coded in the body. Is there a step that I'm missing? Here is the code for the page:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sample table</title>
<script>
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

num = iteration -1

var cell = row.insertCell(0);
var field = document.createElement('input');
field.setAttribute('type','text');
field.setAttribute('name',"qty"+num);
field.setAttribute('value',num);
field.setAttribute('size',3);
cell.appendChild(field);
}
</script>
<meta name="Microsoft Theme" content="blends 000, default">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>
<form method="POST" name="Order Form" action="--WEBBOT-SELF--" onSubmit="">
<!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" S-Email-Address="clflyer@mchsi.com"
S-Email-Format="TEXT/PRE" --><strong>[FrontPage Save Results Component]</strong><!--webbot
bot="SaveResults" endspan -->
<!-- <form action="tableaddrow_nw.html" method="get">-->

<table border="1" id="tblSample" width="292">
<tr>
<th width="282" align="left">Your Order</th>
</tr>
<tr>
<th width="282" align="left" valign="bottom">Qty.</th>
</tr>
<tr>
<td width="282" align="left" valign="bottom"><input type="text" name="txtQty1" size="3" value = "1" readonly></td>
</tr>
</table>
<input type="button" value="Add" onclick="addRowToTable();" />
<input type="submit" value="Submit" name="B1">
</form>
</body>
</html>
 
Works for me. Your server-side script is probably looking for the wrong thing because your first box is name "txtQty1" but all other boxes start with "qty" instead of "txtQty".

Adam
 
I made the correction to name the fields txtQty# in the head and tried it again. The table builds very nicely, but when I submit it I only get txtQty1, none of the added fields come across. You can see what I'm talking about if you try it on this site:


Bill
 
If I change the method from "POST" to "GET" I can see that the form fields are being submitted by looking at my address bar. However, your server-side process is ignoring them. It looks like you're using FrontPage server extensions, which I'm not experienced with. You may have to ask your question in a FrontPage forum.

Adam
 
Thanks Adam, I tried to change it to a Get form but FrontPage changes it back to Post. I'll look for a frontpage forum.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top