2

I have a form with action = post and i am validating it with after validating it I am submitting that form with:

$("#form").submit();

But it is submitting all fields nulled while I have data in those fields. How can I post those fields filled?

2
  • 1
    post your code so that it can be troubleshooted. Commented Oct 13, 2010 at 11:10
  • Did you find the solution? Is there a right answer below? Commented Oct 19, 2010 at 7:57

4 Answers 4

3

I had the same problem, found out that my input was without the name attribute, that is required for post data.

Sign up to request clarification or add additional context in comments.

Comments

2

You could try with "trigger", though I doubt it'll give you a different result:

$(form).trigger("submit");

But I think the real solution, is to put the validation inside the submit method, in this way:

 $("form").submit(function() {
      if ($("input:first").val() == "correct") {
        $("span").text("Validated...").show();
        return true;
      }
      $("span").text("Not valid!").show().fadeOut(1000);
      return false;
    });

Look here to (if the problem is with ie6):

jQuery form submit() is not working in IE6?

Comments

0

Does your form have an id set to "form"? If not just remove the hash from your $("#form")..sorry to be cheeky but there is no code so I am guessing...

Comments

0

submit JQuery method don't send the form, it

Bind an event handler to the "submit" JavaScript event, or trigger that event on an element

You have to use the "standard" submit method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.