If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

"this" refers to the object tasked to perform the event, here you are refering "this" to the link that performs the onclick event, thus trying to display the name of the links object, "form", which does not exist.

If you want to get the name of the form that the link is a child to, you could try climbing up the dom tree with something like alert(this.parentNode.name) or something, but this can give different results in different browsers.

Try telling us what you are trying to do with the code, why u need the name and when to get it, maybe it will be easier to figure out...

"this" refers to the object tasked to perform the event, here you are refering "this" to the link that performs the onclick event, thus trying to display the name of the links object, "form", which does not exist.

If you want to get the name of the form that the link is a child to, you could try climbing up the dom tree with something like alert(this.parentNode.name) or something, but this can give different results in different browsers.

Try telling us what you are trying to do with the code, why u need the name and when to get it, maybe it will be easier to figure out...

the form I am actually using is generated on the fly via php and a smarty template. The thing is that this particular function (a calendar field) works just fine in all the other modules and I was surprised that it doesn't work here, however I was able to get the same error message as from my actual form field...

Essentially I have got a set of fields that lead to a calendar control using javascript to call the respective functions and format the output.
I thought "this" usually points to the current form...probably have been mistaken :-/
Nevertheless how would I reference the actual form that contains my current field...?

the form I am actually using is generated on the fly via php and a smarty template. The thing is that this particular function (a calendar field) works just fine in all the other modules and I was surprised that it doesn't work here, however I was able to get the same error message as from my actual form field...

Essentially I have got a set of fields that lead to a calendar control using javascript to call the respective functions and format the output.
I thought "this" usually points to the current form...probably have been mistaken :-/
Nevertheless how would I reference the actual form that contains my current field...?

The answer is simple. A link is not one of the form's elements (controls). A form can have, as his controls, only: INPUT, TEXTAREA, SELECT, BUTTON and (with some crossbrowser differences) OBJECT elements.