[thelist] form.fieldname notation

Scott Brady evolt at scottbrady.net
Mon Dec 9 11:20:01 CST 2002

>I'm not sure what you are trying to do, but, this.name will provide you with
>the name of the form object like "ssn".  To get the value of the form
>object, you would use "this.ssn.value".  That is assuming you are calling
>"this" is a reference to the form and not the object itself.

Yes, "this" refers to the form object.  So, while this[i].name = "ssn" [which means document.searchform[i].name = "ssn"], this.ssn is undefined (it should alert "[object]"), which is the same as document.searchform.ssn is undefined.

> Since I don't see where you are calling your Javascript from
> in the example you included,

It's called this way:
<script language="javascript" for="searchform" event="onsubmit">

That's an IE-only event model. It's the equivalent of <form name="searchform" onsubmit="return whatever">

Scott Brady

More information about the thelist mailing list