views:

14

answers:

1

I need to validate HTML text Field using JQuery Validation plugin, I don't make and post or get method can any one help?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.4.2.min.js" type="text/javascript">
</script>
<script src="jquery.validate.js" type="text/javascript">
</script>
<script  type="text/javascript">
$().ready(function() {
 $('#btnA').click(function() {
  $("#deivb").validate();
 });

 // validate signup form on keyup and submit
 $("#deivA").validate({
  rules: {
   firstname: "required"
  },
  messages: {
   firstname: "Please enter your firstname"
  }
 });
});


</script>


</head>

<body>


 <div id="divA">
 <fieldset>
  <legend>Validating a complete form</legend>

  <p>
   <label for="firstname" class="required">Firstname</label>
   <input id="firstname" name="firstname" />
  </p>
  </fieldset>
  <p>
   <input id="btnA" class="submit" type="button" value="Submit"/>
  </p>

 </fieldset>
 </div>


</body>
</html>
A: 

Which validation plugin are you using?

Choose one that allows for a callback function that is executed if the plugin returns the form as valid.
That way you can do whatever you'd like with the validated data in your form without having to have a form action.

tb