troubleshooting Question

jquery form validation

Avatar of phparmy
phparmy asked on
Web Languages and StandardsJScriptjQuery
9 Comments1 Solution354 ViewsLast Modified:
i want ot validate like that

<html>
<head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <script language="javaScript" src="../js/jquery-1.3.2.min.js" type="text/javaScript"></script>
      <script>
      function validate(targetForm){
            $(targetForm).submit(function(){
                  if($(':checkbox[myreq=1]').length > 0){
                        if($(':checkbox[myreq=1]:checked').length == 0){
                              var message = $(':checkbox[myreq=1]').attr('message');
                              alert(message);
                              return false;
                        }
                  }
            });
      }
      </script>
</head>
<body>
<form action="page.php" method="post"  onsubmit="return validate(this)">
      <input type="checkbox" name="f[0]" value="0" myreq="1" id="f" message="Please Fill Form">
      <input type="checkbox" name="f[1]" value="1" myreq="1" id="f" message="Please Fill Form">
      <input type="checkbox" name="f[2]" value="2" myreq="1" id="f" message="Please Fill Form">
      <input type="submit" name="send" id="send" value="Ok">
</form>
</body>
</html>

this is my code everything ok but i cant get targetForm something missing here. how can i fix it.
i want to send validate(this) for specifiying which form i want to validate. sending validate(this) current submitted form means.

thanks.
ASKER CERTIFIED SOLUTION
richardneililagan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros