views:

389

answers:

3

I have a form being inserted into a page with jQuery. In all other browsers, it submits correctly... but in Chrome, some extra form fields from other forms on the page are being added to the POST. I'm not using javascript to submit the form, the form is just added with javascript and then submitted with a standard submit input.

Has anyone else had similar experience? Or any ideas on how to deal with this?

Thanks

A: 

If the form is nested within another form, this could trigger the browser in being unable to work out which form and its values you want to send and will try and do its best to send whatever values it thinks belongs to the form.

random
Yeah that was one of my first thoughts as well, but forms are totally different.
Ben
A: 

If this works in other browsers and not in chrome, then you might want to submit a bug. You can do that here. You might also drop by the chromium irc channel on freenode. The people there are usually pretty helpful and might be able to tell you if this is a known bug.

Paul Wicks
A: 

The issue is with the insertion of a noscript tag into the DOM via javascript. I was receiving some HTML from the server with a noscript tag that had a select tag in that. Apparently WebKit-based browsers submit that input with the form.

The simple fix was to parse the HTML with jQuery and remove the noscript tags like so:

$response.find('noscript').remove();
Ben