[RESOLVED] Problem passing form name in Chrome and Firefox, not IE8
Hi there,
I am using dynamically generated forms with (unknown) unique names and id's. When I want to pass the form id with javascript to a function, I receive a message from Chrome (in the javascript console) that it can not read the property id of null.
I investigated this some more, and found that chrome and firefox are not passing the parameter this.form to a function correctly.
A little sample code:
<FORM name="variablename" id="variablename">
<input type="text" name="variablename" id="variablename" onclick="test(this.form);"/>
</FORM>
(variablename stands for an automatically generated name which I can not literally state when calling the function)
The javascript function 'test' looks like this:
function test(form) {
var formid=form.id;
alert(formid);
}
Normaly a popup should arise stating the id of the form. In IE it works, but in Chrome and Firefox it doesn't.
I have figured out what was wrong. Padonak was absolutely wright. My problem was not the passing of this.form to the function, but was a mistake on my side of putting the form tag between the table "tag" and the first "tr" tag.
When you do this, IE is still able to "form" tag, while mozilla isn't.
I didn't mention it in the short code in this post, just to keep the code... short. My mistake again! Padonak, your remark made me strip the code down and test is bit by bit when suddenly...
For those who are interested I wrote a little peace of wrong and wright code...
Bookmarks