No, not necessarily. There are some things in here which someone would find useful. If it's still the same problem, and you haven't solved it, I suggest you continue in this thread rather than start a new one.
Getting error while entry in userid field/responseText not returning value
Collapse
X
-
xmlHttp.respons eText not returning value
I know the function of xmlHttp.respons eText.
But this is not returning any value. I want to check the userid from table and if not found then it should return "Invalid User" in <p id='message'> as soon as cursor moves to next field.
Code of 'main.asp'
Code:<script type="text/javascript"> var xmlHttp function userid2(str){ xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="checkuser.asp?q="+str+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("message").innerHTML=[B]xmlHttp.responseText[/B];} } function GetXmlHttpObject(){ var xmlHttp=null; try { xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari catch (e){ try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} // Internet Explorer catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} } return xmlHttp; } </script> </head> <body onload="document.myform.userid1.focus();"> <form name="myform" action="main.asp" method="post"> <div id="content"> <h2 id="pageName">Main Page</h2> <div class="feature"> <h1>Surfing the intranet </h1> <p> This is a comprehensive information website on Indian Oil Corporation Limited and specially dedicated to Barauni Refinery. </p> </div> <div class="login1" style="position:relative; left:50px"> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td><h3>Employee Login</h3></td> </tr> <tr> <td> <table> <tr> <td align="right">Login :</td> <td><input type="text" name="userid1" id="userid1" style="width:100px " onblur="userid2(this.value);"/></td> </tr> <tr> <td align="right">Password :</td> <td><input type="password" name="passwd" style="width:100px "/></td> </tr> </table> </td> </tr> <tr> <td> <table> <tr> <td><a href="#">Forgot Password?</a></td> <td><input type="button" style="width:65px " value="Go" onclick="login1();"/></td> </tr> </table> </td> </tr> <tr> <td> <table> <tr> <td><p id="message">Enter user id and password</p></td> </tr> </table> </td> </tr> </table> </div> </div>
Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% response.expires = -1 set conn = server.createobject("ADODB.Connection") conn.open "Provider=MSDAORA.1; dsn=ipis; password=ipis; user id=ipis; data source=isap2000; persist security into=true" set rs = server.createobject("ADODB.Recordset") set rs = conn.execute("select empno from hba_empmast where empno="&request.querystring("q")) if isnull(rs("empno")) then %> "Invalid User" <% end if %> </body> </html>
Thanks and regards,
VikasComment
-
Originally posted by acoderNo, not necessarily. There are some things in here which someone would find useful. If it's still the same problem, and you haven't solved it, I suggest you continue in this thread rather than start a new one.
Oh this way, I am sorry sir. Really feel sorry. I have already started new thread. What to do now?Comment
-
Originally posted by vikas251074I know the function of xmlHttp.respons eText.
But this is not returning any value. I want to check the userid from table and if not found then it should return "Invalid User" in <p id='message'> as soon as cursor moves to next field.Comment
-
OK Sir, Thanks
I got the solution.
I changed the line no. 12 - 16 as following as per the suggestion given by you to check the checkuser.asp directly on address bar.
Code:if rs.eof then response.write("Invalid User") else response.write("Enter user id and password") end if
Thanks and regards,
VikasComment
Comment