Mix & match JS and ASP

wxdqz

New Member
Hi!

ive just come from the ASP forums @ 4guysfromrolla.com and there befuddled with this question..so i thought i would come ask a JS genius if there is any..

the problem is i need to submit a button in a form to an ASP page after it the fields have been validated.


the problem is with the login.submit , the ASP code looks for a button called ok...but the form is not submitting it...how can i submit the button with the code?

here is the code:

<%@ Language=VBScript %>
<!--#include file="config.sf"-->

<%
'SPITS THE USER OUT IF THEY HAVE A NETSCAPE BROWSER

Dim DIMuserInfo, DIMie, DIMbrowver, DIMjs, DIMmeta
SET DIMuserInfo = Server.CreateObject("MSWC.BrowserType")

IF NOT((DIMuserInfo.Browser = "IE") OR (DIMuserInfo.version > 4)) then
response.redirect "bad.html"
END IF
SET DIMuserInfo = Nothing

'THREE ATTEMPTS ALLOWED LOGIN

IF ISEMPTY(REQUEST.FORM("ok")) THEN
SESSION("attempts") = 1
DIMmsg = "&nbsp;"
ELSE
DIM DIMfilterID, DIMfilterPW, RSLogin, DIMmsg
DIMfilterID = REPLACE(REQUEST.FORM("id"),"'", "")
DIMfilterPW = REPLACE(REQUEST.FORM("pw"),"'", "")
SET RSLogin = CONN.EXECUTE("SELECT * FROM login WHERE id = '" & DIMfilterID & "' AND PW = '" & DIMfilterPW & "';")
IF(RSLogin.EOF) THEN
Session("attempts") = SESSION("attempts") + 1
IF Session("attempts") => 4 THEN
DIMmsg = "LOGIN NOT FOUND! NO MORE ATTEMPTS ALLOWED!"
ELSE
DIMmsg = "LOGIN NOT FOUND, TRY AGAIN!"
END IF
ELSE
Session("rname") = RSLogin("Rname")
Session("name") = RSLogin("Name")
Session("loginID") = RSLogin("loginID")
Response.Redirect "intro.asp"
END IF
END IF
%>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&sect;h&Atilde;&ETH;&Oslash;W&yen; ƒr&euro;&Atilde;K</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"css%5Cshadowy.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function idform(VARidvalue)
{
if(VARidvalue=="name here")
{
login.id.value='';
}

}

function pwform(VARpwvalue)
{
if(VARpwvalue=="password here")
{
login.pw.value='';
}

}

function validateme(VARidValue, VARpwValue)
{

if(VARidValue=='name here')
{alert("Don't tell me you left the default 'name here' words in?!...tsk tsk tsk, you know better then that!");}
else
{
if(VARpwValue=='password here')
{alert("Don't tell me you left the default 'password here' words in?!...tsk tsk tsk, you know better then that!");}
else
{
if((VARidValue=='') || (VARidValue == null))
{
alert("You forgot your name!");
login.id.focus();
}
else
{
if((VARpwValue=='') || (VARpwValue == null))
{
alert("You forgot your password!");
login.pw.focus();
}
else
{
login.submit();
}
}
}
}

}


//-->
</script>
</head>

<body bgcolor="#000000" text="#FFFFFF" link="#0000CC" vlink="#990000" alink="#FF6600" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
<td align="center" valign="middle"><p><img src=http://www.webdeveloper.com/forum/archive/index.php/"images/SFlogo.jpg" width="475" height="105" /><br><%=DIMmsg%></p>
<%IF NOT(SESSION("attempts") => 4)THEN%>
<form action="index.asp" method="post" name="login" target="_self" id="login">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="middle"> <input name="id" type="text" id="id" value="name here" maxlength="10" onClick="idform(login.id.value)"/></td>
</tr>
<tr>
<td align="left" valign="top"> <input name="pw" type="password" id="pw" value="password here" maxlength="10" onClick="pwform(login.pw.value)" /></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><input name="ok" type="button" id="ok" value="Enter" onClick="validateme(login.id.value, login.pw.value, login.ok.value)" />
<input type="reset" name="Submit2" value="Leave" onClick="javascript: window.location='http://hawkeye/'" /></td>
</tr>
</table>
</form>
<%ELSE%>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<%END IF%>
<font size="-2" face="Times New Roman, Arial, Times, sans-serif">Designed
for MS Internet Explorer 5.00.2919.63.07IC or Better; If you don't like it, tough.<br />
Enter this site at your own risk!</font>
</td>
</tr>
</table>
</body>
</html>
<!--#include file="error.sf"--
 
Back
Top