This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

validating user Input using java script  RSS feed

 
amrut sabade
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone ... i have one registration form which contains text boxfor email and i have to validate wheather the entered email id is valid or not i ma using following script to validate on onblur event.. but its giving me error that object expected... please help ...whats is going wrong with it...
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37234
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which line gives that error?

Also, can you try adding alert(inputField.value) to show that value isn't null. If it is null, show how you are calling the function.
 
amrut sabade
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am calling the function as onblur="return validateEmail()" and this line is giving error...
is it correct tocall function as this
 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
amrut sabade wrote:i am calling the function as onblur="return validateEmail()" and this line is giving error...
is it correct tocall function as this


No, it is not correct, as in the first line you are doing inputField.value.length, if you call the function without the inputField argument this is undefined and it will throw an error in the very first line, try onblur="return validateEmail(this)" (in case you want to check the field where you are setting the onblur)

Also install the firebug plugin to help you create and debug javascript part of your application http://getfirebug.com/ and check the very useful screencasts here http://getfirebug.com/screencasts
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!