Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Validation, Object Expected?! Wot is it- beginners mistake

Status
Not open for further replies.

hpadwal

Programmer
Feb 6, 2006
57
GB
Hello all,

I have a silly mistake in thos validation script for a dropdown box.

"object expected"

Code:
function valformstart(start)
{
	strError = ""
	
	
	if(start.customer.value == "") {
		strError += "Please select your title\n"
	} 
}

Code:
<img src="images/continue.gif" name="submitbut" onMouseOver="swapImage2(1)" onMouseOut="swapImage2(3)" onclick="valformstart (start);"  style="cursor:hand" border="0" />
Code:
<SELECT NAME="customer"onchange="doSel(this)">
					<OPTION VALUE="">Choose...
					<OPTION VALUE="New Customer">New Customer
					<OPTION VALUE="location.href='default.asp?id=9&employer=asda'">Existing Customer
					<OPTION VALUE="Previous">Previous Customer
					</SELECT>
Code:
<form name="start" method="POST" action="default.asp?id=<%=id%>">

I hope that is all the infomation you need.

I know its only a small script but im kind of a beginner - Can you help?

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- Doh

 
Sorry i have changed the function to

Code:
function valformstart(thisform)
{
	strError = ""
	
	
	if(thisform.customer.value == "") {
		strError += "Please select your title\n"
	} 
	if(strError == "") {
		
		thisform.submit();
	}
	else
	{
		alert(strError)
		return false;	
	}
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- Doh

 
Hi Billy Ray,

Yes i have changed the code so it posts the URL i want, slightly different but same effects.

Thanks for your input guys(and gals).



_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- Doh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top