Solved

validate

Posted on 2011-03-15
5
338 Views
Last Modified: 2012-05-11
using jquery.validate  
what would be the syntax to validate just one field within a form?

keep in mind that the one field is within a form and the entire form is also validated.
but this is a different function where an element is clicked and the field in question is validated on being blank or not.
thanks
0
Comment
Question by:dgrafx
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
you just have to capture the onclick event of the element and do the validation.

Where are you struck?
0
 
LVL 24

Author Comment

by:dgrafx
Comment Utility
where am i stuck?
start with syntax ...
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
below is the sample of how to capture the onclick event on an element and check if another field is empty
$("#elementId").bind("click", function(){
   var value = $("#anotherElementId").val();
   if ( value.length == 0  )
   {
      alert("field is empty");
      $("#anotherElementId").focus();
   }
});

0
 
LVL 24

Author Comment

by:dgrafx
Comment Utility
yeah ok - i'll just use something like that.

to explain: i'm working on a project where the owner wants EVERYTHING to be jquery.
ya know - the latest buzz words and catch phrases ...
so some of my really simple questions are really saying "how do you do this using jquery"

thanks a lot
0
 
LVL 40

Expert Comment

by:gurvinder372
Comment Utility
Its Ok, hurl in your questions :)

Thanks for the points
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now