• 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

validating user Input using java script

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 312
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic