okay I am NO good with Javascript so please do not laugh it my awful code..

What I am trying to achieve sounded so easy in principle but the more I read up on it the worse I got and have ended up not knowing whether I am coming or going

Okay I have a html form (simple search and advanced search screens) I need to check that of the field that are completed they must be at least 2 characters in length and must contain an alphanumeric value.

so what I have got is this:
code on my form
onSubmit="return checksearchdata(this)" name=f1
and then in JS code I have this (kind of)

function checksearchdata(obj) 
	var formObj = f1code;
	var codeReg = new RegExp(/[a-z][0-9]/)
	if (!codeReg.test(formObj.value))
		alert("Your data is not valid for the "+formObj.name);
		return false;

	var min = 2;
		if (!field.value || field.value.length < min) 
		return false;

	return true;
I am doubting the min length as I am looking at (obj) rather than field.length.. I already check previously that at least one field in filled in, so its only to check the filled in fields are 2 digits min etc etc

please help and please don't laugh

Thanking you