Form validation

JQuery with Ajax and PHP

Page 1 of 1

1 Replies - 2312 Views - Last Post: 06 June 2010 - 06:47 AM

#1 1cookie   User is offline

  • D.I.C Regular

Reputation: -5
  • View blog
  • Posts: 338
  • Joined: 19-October 06

Form validation

Posted 04 June 2010 - 04:30 AM

hi

I hav a good ol form. :)

<form id="myform" action="results.php" method="GET"> 



OK, using this:

<?php
//index.php file
?>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>



  <script>
  $(document).ready(function(){
    $("#myform").validate({
   errorContainer: "#messageBox1, #messageBox2",
   errorLabelContainer: "#messageBox1 ul",
   wrapper: "li", debug:true,
   
      })
  });
   
  </script>
  
  <body>
  ...

<form id="myform" action="results.php" method="GET"> 

...

</body>




code, the form validates fine, displays all errors in custom open shut <div></div> tags, perfect! However, the page will not submit any data to 'results.php'.

If i then change the page to this:

<?php
//index.php file
?>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script> 
<script type="text/javascript" src="js/jquery.form.js"></script>


  <script>
  $(document).ready(function(){
    $("#myform").validate({
   errorContainer: "#messageBox1, #messageBox2",
   errorLabelContainer: "#messageBox1 ul",
   wrapper: "li", debug:true,
   
      })
  });
  
  // bind 'myForm' and provide a simple callback function 
            $('#myForm').ajaxForm(function() { 
                alert("Thank you for your comment!"); 
            }); 
        }); 
  
  </script>

...

 <body>
  ...

<form id="myform" action="results.php" method="GET"> 

...

</body>




now making use of JQuery, Ajax and PHP - I can submit the data and the script takes me through to the 'results.php' page successfully - but my form no longer validates when i put some invalid data in it??

help.. :bigsmile:

Is This A Good Question/Topic? 0
  • +

Replies To: Form validation

#2 Guest_Andy*


Reputation:

Re: Form validation

Posted 06 June 2010 - 06:47 AM

SOLVED:
see: link
Was This Post Helpful? 0

Page 1 of 1