I have a classic ASP application that I have to maintain and have some new enhancements to program into it. What i need to do is validate a couple of fields on the web page form. To do this I need to call a server-side function that will use the value of the field and conduct a JScript ADO function that will execute a stored procedure and return a ‘Y’ or ‘N’ if the record was found or not. I want to pass this value back to the client-side Jscript function and display an alert if the result is “N”. here’s a code snippet.
[COLOR=Sienna]client side JScript
[SIZE=1]function button_onclick() {
var res;
res = GetEmp(window.document.forms[“frmAddVol”].elements[“EmpNum”].value);
if res == “N” {
alert(“Invalid Emp Num”);
}
}[/SIZE]
[COLOR=Sienna]Server-Side JScript
[SIZE=1]functionGetEmp(id){
var resval;
….perform ADO database lookup using id as the criteria parameter
return resval;
}
The server side code resides in a separate file the is included in the web page using the standard <!–#include …–> statement.
My problem is that the script dies when invoking the GetEmp function. The error message is “Object expected”.
what do i need to do to get this to work as described?
Thanks
the Mad Jammer