Marc Elser wrote:
[color=blue]
> Can someone please tell me how to access the form name if there's a form
> field named "name", for example:
>
> <form name="myform">
> <input type="text" name="name" value="Marc">
> <input type="button" onClick="alert(this.form.name);">
> </form>
>
> When I do this, the alert shows "[object HTMLInputObject]" (in firefox)
> or just "[object]" (in ie6) instead of the string "myform".
>
> the problem is that I access the form element named "name" instead of
> the forms name property.
>
> Problem is this is a simplified example, in my real program there's
> nothing I an do about the input elements name or else the cgi program
> which receives the form values crashes, means i cannot change "<input
> type="text" name="name"...>" to let's say <input type="text"
> name="surname">".
>
> Is there any solution to this problem? Thanks for any help. I suppose
> there is some way of accessing the form's name property with the correct
> notation.[/color]
With Mozilla I think it works to read
form.getAttribute('name')
but IE messes things up when it comes to distinguishing between HTML
attributes and JavaScript properties.
--
Martin Honnen
http://JavaScript.FAQTs.com/