Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6190077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:31:18+00:00 2026-05-24T02:31:18+00:00

On a fansite im doing http://yamikowebs.com/ee/ I have a few forms (2 atm). I

  • 0

On a fansite im doing http://yamikowebs.com/ee/
I have a few forms (2 atm). I used $.post to find out what form is being submited. submit the form and display that pages results where the form was originally with .html().

My next step was to use the validator which is working fine but im not sure how to put the 2 together.

submitHandler: function(form){} seems to be the setting for how its submitted. However, I can’t get this to work with my $.post function or find out what form is being processed.

If I leave the defaults for validation plug-in if there no errors it will send you to the page. the ajax plug-in that it works with doesn’t do what I want. Below is my $.post function

form validation:

//ajax post
$("form").submit(function(event)
{
    event.preventDefault();//stop from submiting
            //set needed variables
    var $form = $(this)
    var $div = $form.parent("div")
            $url = $form.attr("action");
            //submit via post and put results in div
    $.post( $url, $form.serialize() , function(data) 
    { $div.html(data) })

})

http://docs.jquery.com/Plugins/validation#source is the validation plugin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:31:19+00:00Added an answer on May 24, 2026 at 2:31 am

    You’re correct in thinking that submitHandler is the right callback to use. However, I ran into some interesting issues while using it with multiple forms (like you’re trying to do). For example, in this code:

    $("#form1, #form2").validate({
        submitHandler: function(form) {
            alert(form.action);
            alert(form.id);
        }
    });
    

    The submitHandler callback does not get supplied the correct parameter (it always gets #form1). I believe this is actually a bug in jQuery-validate (so I’ve filed it here).

    Anyway, a decent workaround would be to wrap the validate call in .each():

    $("form").each(function() {
        $(this).validate({
            submitHandler: function(form) {
                /* 'form' has the correct value */
                var values = $(form).serialize(),
                    $div = $(form).parent("div");
    
                alert(form.action);
                alert(form.id);
                /* Perform AJAX call here */
            }
        });
    });
    

    Example: http://jsfiddle.net/andrewwhitaker/MmCXN/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I am working on a fansite, and I can't figure out why my
This is my first post, but I've loved using this site as resource for
I'm new to programming (just started!) and have hit a wall recently. I am
This may belong on Serverfault, but I don't think so. I have a website
I've embedded some YouTube videos in my fansite I'm developing. However, when you scroll
I am currently having issues with the 60 day access_token. I grab the fansite
A while ago I built a fan site for a PC game, and I
For example, I want a user to create a new fanclub for a given
I am coding a fan site for a game called League of Legends and
I want to make a fan site for the online game runescape. I'm making

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.