?
Solved

Difference between validate(), valid() and val()

Posted on 2011-10-03
4
Medium Priority
?
319 Views
Last Modified: 2012-05-12
I am trying to find a bug where calling "value() != true" is causing strange behavior. And am trying to find what additional things would get called (by the jQuery library) as a result, to find the bug.

Any suggestion about how to find out?

Thanks.
0
Comment
Question by:newbieweb
4 Comments
 
LVL 40

Assisted Solution

by:Gurvinder Pal Singh
Gurvinder Pal Singh earned 400 total points
ID: 36908847
<<I am trying to find a bug where calling "value() != true" is causing strange behavior>>
Please elaborate.

Is there any method called value() that you are using? or this is a typo and you are actually using the val() only?
0
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 1200 total points
ID: 36908849
validate() sets up the relevant exception handlers on the form. You must call this before using valid().

http://docs.jquery.com/Plugins/Validation/validate

valid() returns true or false and is used to validate form elements

http://docs.jquery.com/Plugins/Validation/valid

Val() is nothing to do with validation. It gets the value from a form element.

http://docs.jquery.com/Val

Post your code so I can see what you've got so far.

Lee
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 400 total points
ID: 36909869
val() returning anything not null, empty string undefined or 0 will be true.
0
 

Author Closing Comment

by:newbieweb
ID: 36916586
Thanks.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question