473,372 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Getting error while entry in userid field/responseText not returning value

vikas251074
198 100+
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support this property or method'.

Expand|Select|Wrap|Line Numbers
  1. <form name="myform" action="main.asp" method="post">
  2. <div id="content"> 
  3.   <h2 id="pageName">Main Page</h2> 
  4.   <div class="feature"> 
  5.     <h1>Surfing the intranet </h1> 
  6.     <p>
  7.     This is a comprehensive information website on Indian Oil Corporation Limited and specially 
  8.     dedicated to IOCL.
  9.     </p>
  10.   </div> 
  11.   <div class="login" style="position:relative; left:50px"> 
  12.     <table border="1" cellpadding="0" cellspacing="0">
  13.     <tr>
  14.       <td bgcolor="#99FF99"><h3>Employee Login</h3></td>
  15.     </tr>
  16.     <tr>
  17.       <td>
  18.         <table bgcolor="#CCFFCC">
  19.           <tr>
  20.             <td align="right">Login :</td>
  21.             <td><input type="text" name="userid" id="userid" style="width:100px " onblur="userid(this.value);"/></td>
  22.           </tr>
  23.           <tr>
  24.             <td align="right">Password :</td>
  25.             <td><input type="password" name="passwd" style="width:100px "/></td>
  26.           </tr>
  27.         </table>
  28.       </td>
  29.     </tr>
  30.     <tr>
  31.       <td>
  32.         <table bgcolor="#CCFFCC">
  33.           <tr>
  34.             <td><a href="#">Forgot Password?</a></td>
  35.             <td><input type="button" style="width:65px " value="Go" onClick="login();"/></td>
  36.           </tr>
  37.         </table>
  38.       </td>
  39.     </tr>
  40.     </table>
  41.   </div> 
  42. </form>

The description of userid(this.value) is as follows -
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var xmlHttp
  3.  
  4. function userid1(str){
  5.   xmlHttp=GetXmlHttpObject();
  6.   if (xmlHttp==null) {
  7.     alert ("Your browser does not support AJAX!");
  8.     return;
  9.   } 
  10.   var url="checkuser.asp?q="+str+"&sid="+Math.random();
  11.   xmlHttp.onreadystatechange=stateChanged;
  12.   xmlHttp.open("GET",url,true);
  13.   xmlHttp.send(null);
  14. }
  15.  
  16. function stateChanged() { 
  17.   if (xmlHttp.readyState==4) {
  18.     document.getElementById("login").innerHTML=xmlHttp.responseText;}
  19. }
  20.  
  21. function GetXmlHttpObject(){
  22.   var xmlHttp=null;
  23.   try { xmlHttp=new XMLHttpRequest();  }   // Firefox, Opera 8.0+, Safari
  24.   catch (e){ 
  25.     try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}   // Internet Explorer
  26.     catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
  27.   }
  28.   return xmlHttp;
  29. }
  30.  
  31. </script>
I think error is in line no. 21 where the function 'userid(this.value) is called and the error message is 'Object doesn't support this property or method'.

Thanks and regards,
Vikas
Jun 20 '08 #1
21 3780
gits
5,390 Expert Mod 4TB
try the following:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("login").value = xmlHttp.responseText;
instead of using innerHTML ...

kind regards
Jun 20 '08 #2
vikas251074
198 100+
I have tried this, but get no solution.

I think login is not an <div Id >. It is a <div class=login>

So how this problem will be solved.

Thanks and regards,
Vikas
Jun 20 '08 #3
gits
5,390 Expert Mod 4TB
aaarg ... sorry i just had a quicklook and overlooked that ... the value will not work with divs ... of course.

just give your div an id="login" ... is there any reason why you didn't do that?

kind regards
Jun 20 '08 #4
vikas251074
198 100+
Yes sir,
I have created main div with an <div id="content">
And all the div created with in this div is defined in
<div class="feature">
<div class="login">

I have done this way. Is it wrong?

Thanks and regads,
Vikas
Jun 20 '08 #5
acoder
16,027 Expert Mod 8TB
I think error is in line no. 21 where the function 'userid(this.value) is called and the error message is 'Object doesn't support this property or method'.
Well, it's not surprising if you've called it userid1.
Jun 20 '08 #6
vikas251074
198 100+
Yes I have done this also, but not getting solution. The error message is same.

Thanks and regards,
Vikas
Jun 20 '08 #7
acoder
16,027 Expert Mod 8TB
Have you added the id to the div as suggested earlier?
Jun 20 '08 #8
vikas251074
198 100+
Yes,
I have done that way also

<div id="login">
and also
<div id="login1">

But with no hope!!!!
Jun 21 '08 #9
acoder
16,027 Expert Mod 8TB
Post the latest version of your code.
Jun 21 '08 #10
vikas251074
198 100+
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var xmlHttp
  3.  
  4. function userid1(str){
  5.   xmlHttp=GetXmlHttpObject();
  6.   if (xmlHttp==null) {
  7.     alert ("Your browser does not support AJAX!");
  8.     return;
  9.   } 
  10.   var url="checkuser.asp?q="+str+"&sid="+Math.random();
  11.   xmlHttp.onreadystatechange=stateChanged;
  12.   xmlHttp.open("GET",url,true);
  13.   xmlHttp.send(null);
  14. }
  15.  
  16. function stateChanged() { 
  17.   if (xmlHttp.readyState==4) {
  18.     document.getElementById("login1").value=xmlHttp.responseText;}
  19. }
  20.  
  21. function GetXmlHttpObject(){
  22.   var xmlHttp=null;
  23.   try { xmlHttp=new XMLHttpRequest();  }   // Firefox, Opera 8.0+, Safari
  24.   catch (e){ 
  25.     try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}   // Internet Explorer
  26.     catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
  27.   }
  28.   return xmlHttp;
  29. }
  30.  
  31. </script>
  32. </head>
  33. <body onload="document.myform.userid1.focus();"> 
  34. <form name="myform" action="main.asp" method="post">
  35. <div id="content"> 
  36.   <h2 id="pageName">Main Page</h2> 
  37.   <div class="feature"> 
  38.     <h1>Surfing the intranet </h1> 
  39.     <p>
  40.     This is a comprehensive information website on XXXXXXXX.
  41.     </p>
  42.   </div> 
  43.   <div id="login1" style="position:relative; left:50px"> 
  44.     <table border="1" cellpadding="0" cellspacing="0">
  45.     <tr>
  46.       <td bgcolor="#99FF99"><h3>Employee Login</h3></td>
  47.     </tr>
  48.     <tr>
  49.       <td>
  50.         <table bgcolor="#CCFFCC">
  51.           <tr>
  52.             <td align="right">Login :</td>
  53.             <td><input type="text" name="userid1" id="userid1" style="width:100px " onchange="userid1(this.value);"/></td>
  54.           </tr>
  55.           <tr>
  56.             <td align="right">Password :</td>
  57.             <td><input type="password" name="passwd" style="width:100px "/></td>
  58.           </tr>
  59.         </table>
  60.       </td>
  61.     </tr>
  62.     <tr>
  63.       <td>
  64.         <table bgcolor="#CCFFCC">
  65.           <tr>
  66.             <td><a href="#">Forgot Password?</a></td>
  67.             <td><input type="button" style="width:65px " value="Go" onclick="login1();"/></td>
  68.           </tr>
  69.         </table>
  70.       </td>
  71.     </tr>
  72.     </table>
  73.   </div> 
  74. <div>
Jun 21 '08 #11
acoder
16,027 Expert Mod 8TB
A div doesn't have a value property. Use innerHTML instead.
Jun 21 '08 #12
vikas251074
198 100+
This property is not working. I have modified line no.18 as follows-.

document.getElementById("login1").innerHTML=xmlHtt p.responseText;}


Thanks and regards,
Vikas
Jun 23 '08 #13
acoder
16,027 Expert Mod 8TB
Are you still getting the same error?

What's supposed to be output from the ASP file?

You should add a check for the status too
Expand|Select|Wrap|Line Numbers
  1. if (xmlHttp.readyState == 4) {
  2.     if (xmlHttp.status == 200) {
  3.         // now set login1...
Jun 23 '08 #14
vikas251074
198 100+
Stop this thread sir.

I have modified the programme. Now I will start new thread now because this thread I think is useless.

Thanks and regards
Vikas
Jun 23 '08 #15
acoder
16,027 Expert Mod 8TB
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.
Jun 23 '08 #16
vikas251074
198 100+
I know the function of xmlHttp.responseText.
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'
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. var xmlHttp
  3.  
  4. function userid2(str){
  5.   xmlHttp=GetXmlHttpObject();
  6.   if (xmlHttp==null) {
  7.     alert ("Your browser does not support AJAX!");
  8.     return;
  9.   } 
  10.   var url="checkuser.asp?q="+str+"&sid="+Math.random();
  11.   xmlHttp.onreadystatechange=stateChanged;
  12.   xmlHttp.open("GET",url,true);
  13.   xmlHttp.send(null);
  14. }
  15.  
  16. function stateChanged() { 
  17.   if (xmlHttp.readyState==4) {
  18.     document.getElementById("message").innerHTML=xmlHttp.responseText;}
  19. }
  20.  
  21. function GetXmlHttpObject(){
  22.   var xmlHttp=null;
  23.   try { xmlHttp=new XMLHttpRequest();  }   // Firefox, Opera 8.0+, Safari
  24.   catch (e){ 
  25.     try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}   // Internet Explorer
  26.     catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
  27.   }
  28.   return xmlHttp;
  29. }
  30.  
  31. </script>
  32. </head>
  33. <body onload="document.myform.userid1.focus();"> 
  34. <form name="myform" action="main.asp" method="post">
  35. <div id="content"> 
  36.   <h2 id="pageName">Main Page</h2> 
  37.   <div class="feature"> 
  38.     <h1>Surfing the intranet </h1> 
  39.     <p>
  40.     This is a comprehensive information website on Indian Oil Corporation Limited and specially 
  41.     dedicated to Barauni Refinery.
  42.     </p>
  43.   </div> 
  44.   <div class="login1" style="position:relative; left:50px"> 
  45.     <table border="1" cellpadding="0" cellspacing="0">
  46.     <tr>
  47.       <td><h3>Employee Login</h3></td>
  48.     </tr>
  49.     <tr>
  50.       <td>
  51.         <table>
  52.           <tr>
  53.             <td align="right">Login :</td>
  54.             <td><input type="text" name="userid1" id="userid1" style="width:100px " onblur="userid2(this.value);"/></td>
  55.           </tr>
  56.           <tr>
  57.             <td align="right">Password :</td>
  58.             <td><input type="password" name="passwd" style="width:100px "/></td>
  59.           </tr>
  60.         </table>
  61.       </td>
  62.     </tr>
  63.     <tr>
  64.       <td>
  65.         <table> 
  66.           <tr>
  67.             <td><a href="#">Forgot Password?</a></td>
  68.             <td><input type="button" style="width:65px " value="Go" onclick="login1();"/></td>
  69.           </tr>
  70.        </table>
  71.       </td>
  72.     </tr>
  73.     <tr>
  74.       <td>
  75.         <table>
  76.           <tr>
  77.             <td><p id="message">Enter user id and password</p></td>
  78.           </tr>
  79.         </table>
  80.       </td>
  81.     </tr>
  82.   </table>
  83.   </div> 
  84. </div>
Code of 'checkuser.asp
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. </head>
  5. <body>
  6. <%
  7. response.expires = -1
  8. set conn = server.createobject("ADODB.Connection")
  9. conn.open "Provider=MSDAORA.1; dsn=ipis; password=ipis; user id=ipis; data source=isap2000; persist security into=true"
  10. set rs = server.createobject("ADODB.Recordset")
  11. set rs = conn.execute("select empno from hba_empmast where empno="&request.querystring("q"))
  12. if isnull(rs("empno")) then
  13. %> 
  14. "Invalid User"
  15. <%
  16. end if
  17. %>
  18. </body>
  19. </html>
I think error is in line no. 14.

Thanks and regards,
Vikas
Jun 23 '08 #17
vikas251074
198 100+
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.

Oh this way, I am sorry sir. Really feel sorry. I have already started new thread. What to do now?
Jun 23 '08 #18
acoder
16,027 Expert Mod 8TB
Oh this way, I am sorry sir. Really feel sorry. I have already started new thread. What to do now?
No worries. I've merged the threads.
Jun 23 '08 #19
acoder
16,027 Expert Mod 8TB
I know the function of xmlHttp.responseText.
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.
This code looks better already (you're not replacing the div that contains the login field). You can continue using onchange, though onblur is not too bad in this case. The first thing to check is that the ASP file outputs the correct info. Type the checkuser.asp URL directly into the address bar and test it. What does it output?
Jun 23 '08 #20
vikas251074
198 100+
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.

Expand|Select|Wrap|Line Numbers
  1. if rs.eof then
  2. response.write("Invalid User")
  3. else
  4. response.write("Enter user id and password")
  5. end if
This problem is solved.

Thanks and regards,
Vikas
Jun 23 '08 #21
acoder
16,027 Expert Mod 8TB
Glad to hear that you managed to solve it. So I guess it was an ASP problem all along.
Jun 24 '08 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dinçer | last post by:
Hi, I am trying to get user data (email data actually) from Active Directory. What I exactly want to do is, getting the email address according to username from the domain. For example, when I...
11
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this...
2
by: Alex Wisnoski | last post by:
I have an A97 application that I am modifying. I have created an unbound form, "zfrmTestEnterPlacements", with a subform, "zsfrmSelectPlacement". The intent is to use a combo box on the primary...
11
by: suzy | last post by:
i am trying to write aspx login system and the login process requires a validity check of username and password. i have been told that raising exception is costly, but i want a custom error...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
1
by: C.Joseph Drayton | last post by:
Hi All, I am not sure if this is a JavaScript or PHP error. Basically what is happening, is that I have an HTML page with the following JavaScript. As you can see makeRequest() calls a PHP...
6
by: MLH | last post by:
I have a query (SQL below) that operates on values entered by users into an unbound form to append a record to tblAdmin. I do not under- stand the basis for the error. There are some 17 or so data...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.