wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes validating user Input using java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validating user Input using java script" Watch "validating user Input using java script" New topic
Author

validating user Input using java script

amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
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

Joined: Apr 08, 2009
Posts: 298
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
 
jQuery in Action, 2nd edition
 
subject: validating user Input using java script
 
Similar Threads
how to encrypt the text
how to create small windows
Choose drop down list option with more than one character?
SSL error
catching ascii key codes in javascrip