Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

validate

Posted on 2011-03-15
5
Medium Priority
?
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
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:
Gurvinder Pal Singh earned 2000 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:Gurvinder Pal Singh
ID: 35137075
Its Ok, hurl in your questions :)

Thanks for the points
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

722 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