[thelist] RESUBMIT: Form.field.notation

Scott Brady evolt at scottbrady.net
Tue Dec 10 13:09:01 CST 2002

I submitted the following yesterday but I'm guessing it wasn't very clear how I explained it.

Let me try this:

We have a search form. The form has a drop-down for the field you want to search by. The text box initially has the name of "last_name". It also has an attribute called "validate" which lists the validation function for the last_name (which is just "true").

When you change the dropdown box to "Social Security #", we also change the name of the field to "ssn" and the validate attribute to "vSSN(document.searchform.ssn)".

The validate is how the field is going to be validated when you hit submit. When you hit submit, that function (along with any others that may be used, because there is also the ability to add more search fields) is supposed to be called.

In the onsubmit routine, I have this:

function checkTheForm(theForm)
	for (i=0; i<theForm.length; i++)
		if (theForm[i].validate)
	return false;

Right now, all this function needs to do is loop along the form fields, and if it comes across one where the validate attribute exists, alert(theForm[i].name) and alert(theForm.ssn) [because when I'm testing it, the field's name is "ssn"].  Which means, it should alert "ssn" and "[object]" (theForm.ssn should be a form field object).  However, it's alerting "ssn" and "undefined".

This should be fairly simple, but so far no one here can figure out why it's not working properly.  Any ideas why theForm[i].name works and returns "ssn" but it doesn't recognize theForm.ssn as an object?


Scott Brady

More information about the thelist mailing list