# VBForums CodeBank > CodeBank - JavaScript >  Required text fields & combos

## Evan

```
<script LANGUAGE="JavaScript">
	<!--
	function checkrequired(which) {
	var pass=true;
	if (document.images) {
	for (i=0;i<which.length;i++) {
	var tempobj=which.elements[i];
	if (tempobj.name.substring(0,8)=="required") {if (((tempobj.type=='text'||tempobj.type=='textarea')&&tempobj.value=='')||(tempobj.type[0]=='s'&&tempobj.options[tempobj.selectedIndex].value=='')) {
	pass=false;
	break;
		}
	}
	}
	}
	if (!pass) {
	shortFieldName=tempobj.name.substring(8,30).toUpperCase();
	alert("Please make sure the all required fields are completed.");
	return false;
	}
	else
	return true;
	}
	-->
	</script>
	</head
```


just stick required before any input field name, and it works!

Combos should have no text in the first option

----------

