Validate page and redirect after clicking on submit button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chandan norway
    New Member
    • Nov 2012
    • 1

    Validate page and redirect after clicking on submit button

    In HTML when i click on submit button it should validate the page and after validation it should redirect to the another page?How can do this?can one known answer to this question plz reply it....
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    - attach a validating function to the submit event of the form
    - if the validation fails, stop submitting the form

    Comment

    • sharpcoders
      New Member
      • Dec 2012
      • 2

      #3
      Solution 1:
      Use jQuery Validate plugin.
      Solution 2:
      Make a javascript validation function and call it on form onsubmit event. It should return false when invalid data is entered in the textboxes etc.

      Comment

      • dianagaby2002
        New Member
        • Jul 2012
        • 9

        #4
        Check with javascript/php/... to validate the form.

        PHP: Create the form in html/php file (The writing of the form differs for each page: in php you write the form just like in html but put it in an echo like echo"
        Code:
        <form action='proces_file.php? method='post' onSubmit="JSFunction()"> ... </form>
        ") The JSFunction is in header section. If it returns true, form will be submitted. (You can make it return true if form is valid)

        Then in process_file.ph p you do what you want with the submitted info.

        Comment

        Working...