/    Sign up×
Community /Pin to ProfileBookmark

Dynamicly added form elements dont get posted in FF

Hi,

I have cleated a bit of code that will dynamicly add a new line to a form so the use can add an infinat number of entires for this element.

The code adds the form elemetns in IE and FF ok but when i click the submit button it does not submit the information from the dynamicly added elements in FF.

Oddly enough IE works fine!

Here is the code:

[CODE]function addRow()
{
var append = document.getElementById(‘append’);

var div = document.createElement(“DIV”);

var in1 = document.createElement(“input”);
in1.type = ‘text’;
in1.name = ‘qs_name[]’;
in1.size = ’20’;

div.appendChild(in1);

div.appendChild(document.createTextNode(” : “));

var in2 = document.createElement(“input”);
in2.type = ‘text’;
in2.name = ‘qs_value[]’;
in2.size = ’40’;

div.appendChild(in2);

append.appendChild(div);
}
[/CODE]

[code=html]
<tr>
<td>Quick Spec:</td>
<td><input size=”20″ value=”test1″ name=”qs_name[]” type=”text”> : <input size=”40″ value=”test1″ name=”qs_value[]” type=”text”></td>
</tr>
<tr>
<td></td>
<td><div id=”append”></div></td>
</tr>
<tr>
<td></td>
<td><a href=”javascript:addRow(”)”>Add Row</a></td>
</tr>
[/code]

Any ideas? its driving me nuts!

Thanks
Steve

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@stevet1984authorSep 08.2010 — even with simplifying it to this is still doesnt work in FF

[CODE]function addRow()
{

var newdiv = document.createElement('div');
newdiv.innerHTML = "<input type='text' name='myInputs'>";
document.getElementById('append').appendChild(newdiv);
}
[/CODE]


Gurrrrr!!! :mad:
×

Success!

Help @stevet1984 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...