Solved

validate

Posted on 2011-03-15
5
340 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
ID: 35136971
you just have to capture the onclick event of the element and do the validation.

Where are you struck?
0
 
LVL 25

Author Comment

by:dgrafx
ID: 35136995
where am i stuck?
start with syntax ...
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 35137021
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 25

Author Comment

by:dgrafx
ID: 35137062
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
ID: 35137075
Its Ok, hurl in your questions :)

Thanks for the points
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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…

773 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