473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamically generated form fields not recognized by some browsers when submitting

verbatim
with the following page, the dynamically generated fields are not recognized when i try to submit the form, or add more elements.

when i hit my submit button, the address bar has only x1 - x5 in the query string, and does not append any of the dynamically generated fields.

any ideas how to fix this?



[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<head>
<title>form</title>
<script type="text/Javascript">

function addContent(initialize)
{
initializeHTML = '<table border="1" cellspacing="0" cellpadding="3"><tr><td>Guest Name<\/td><td>Guest Email Address<\/td><\/tr>';
if (initialize) { for (x=1;x<=6;x++) { initializeHTML += '<tr><td><input type="text" class="guestName" name="guest'+x+'" value="" /><\/td><td><input type="text" name="guestEmail'+x+'" value="" /><\/td><\/tr>'; } }
else
{
var inputValues = howManyFriends();
for (x=0;x<inputValues.length;x++)
{
var splitVals = inputValues[x].split('|');
initializeHTML += '<tr><td><input type="text" class="guestName" name="guest'+x+'" value="'+splitVals[0]+'" /><\/td><td><input type="text" name="guestEmail'+x+'" value="'+splitVals[1]+'" /><\/td><\/tr>';
}
initializeHTML += '<tr><td><input type="text" class="guestName" name="guest'+x+'" value="" /><\/td><td><input type="text" name="guestEmail'+x+'" value="" /><\/td><\/tr>';
}
initializeHTML += "<\/table>";
document.getElementById("guestList").innerHTML = initializeHTML;
}

function howManyFriends()
{
gn = "guest"; gne="guestEmail";
f = document.invitation;
var friendCounter = 0;
previous=-1;
counter=0;
var menuItem = new Array();
alert(f.length);
for (x = 0; x < f.length; x++)
{
var count=x+1; var friendCounter=0;
var filterName = /guest[0-9]+/;
var filterEmail =/guestEmail[0-9]+/;
if ( filterName.test(f[x].name) || filterEmail.test(f[x].name) )
{
whichone = (filterName.test(f[x].name)) ? gn : gne;
whichNumber = parseInt(f[x].name.replace(whichone, ""));
if (isNaN(whichNumber)){alert("not numb");}
if (whichNumber==previous)
{
temp = temp + "|" + f[x].value;
menuItem[counter]= temp;
previous=-1;
counter++;
}
else { temp=f[x].value; previous=whichNumber; }
}
}
return menuItem;
}

</script>

</head>
<body onload="addContent(true);">

<form name="invitation">
<div id="guestList"></div>
<input type="" name="x1"><br>
<input type="" name="x2"><br>
<input type="" name="x3"><br>
<input type="" name="x4"><br>
<input type="" name="x5"><br>

<a href="#" onclick="addContent(); return false;">add</a>
<a href="#" onclick="howManyFriends(); return false;">Test</a>
<input type="submit">
</form>
</body>
</html>[/HTML]
Feb 20 '07 #1
1 2230
dmjpro
2,476 2GB
try to search help on document.createElement
Feb 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: CJM | last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter> key is pressed? As I understood it, if you have a form with a single submit button, if enter is pressed, the form...
1
by: Peter Kirk | last post by:
Hi there I have a form which submits a list of data to a web-application (which then saves to a database). The list consists of four input fields per row. Eg....
4
by: John Fereira | last post by:
So, one of the limitations of multipart-form handling is that when an <input type="file" ..> tag is used it will bring up a window which allows a user to select a file for upload but won't allow...
4
by: EmmettPower | last post by:
Hi, I have a form which includes a field 'number'. When 'number' is changed additional fields ('item_0', etc) are generated on the form using 'onchange'. I want to validate the form using...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
4
by: Stone Chen | last post by:
Hello, I have form that uses javascript createElement to add additional input fields to it. However, my validating script will not process new input fields because it can only find the named...
1
by: adamredwards | last post by:
I have a page with some form elements that are dynamically generated. They are inserted into the dom by first cloning a node, changing the values like name, and then inserted with insertBefore(). ...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
7
by: vunet | last post by:
My form uploads files by submitting them to hidden IFrame. I set enctype "multipart/form-data" dynamically. This works great everywhere but IE6. I discovered that in IE6 I need to set encoding...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.