• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajax code getting null value

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I write JSP and Servlet in order to register user and onkeyup I am calling my ajax code which is validating whether userID is already register or not. My problem is that ajax code always getting null value for valid tag value and because of that it's showing always valid user ID. Please find my code as follow:

1. register.jsp



2. FormValidation.java


3. validateUserId.js


Can anyone help me? I had mark ajax code in red color where I am getting error.

Thanking You,
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you debugged what is coming from the server? Use a tool such as Fiddler or Firebug to watch the http requests. Is it sending the right data? Is it returning the right data?

Eric
 
Kasparov Patel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My servlet code firing query is ok. But I don't know why valid tag showing undefined. I have debug using crome developer tool.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well the responseXML should be read off the root



You also have to be carefule of using firstChild since whitepspace is known to cause issue with browsers.

Eric
 
Kasparov Patel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried what you have suggested but getting same following error


Unable to get value of the property 'getElementsByTagName': object is null or undefined
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what does xmlMessage show?



If it is null, that means your xml is not valid.

Eric
 
Kasparov Patel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting following error


SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
LOG: [object]
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
validateUserId.js, line 54 character 13
SCRIPT5007: Unable to get value of the property 'firstChild': object is null or undefined
validateUserId.js, line 44 character 9
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you have more than one bug.

fanme

Eric
 
Kasparov Patel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had corrected that typo error. Thanks for your help. Now it's working.
 
Well THAT's new! Comfort me, reliable tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic