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 8529947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:08:44+00:00 2026-06-11T09:08:44+00:00

I have a very simple form with a few fields and a couple of

  • 0

I have a very simple form with a few fields and a couple of checkboxes. What I need is when the postto checkbox is checked, it calls a function before it submits.

How can am I able to do this??

$("#form").validate({
    debug: true,
    errorContainer: $(".warning"),
    rules: {
        comment: {
            maxlength: 25
        },
        'phone': {
            number: true
        }
    },
    submitHandler: function(form) {
        form.submit();  
     }
});


<form id="form" method="post">
    <div class="first"><textarea name="comment" id="comment" tabindex="1" placeholder="Write your fondest memory here *" required></textarea></div>
    <div><label for="firstname">First Name *</label><input name="firstname" type="text" id="firstname" tabindex="2" required></div>
    <div><label for="lastname">Last Name *</label><input name="lastname" type="text" id="lastname" tabindex="3" required></div>
    <div><label for="email">Email Address *</label><input name="email" type="email" id="email" tabindex="4" required></div>
    <div><label for="phone">Phone Number *</label><input name="phone" type="text" id="phone" tabindex="5" required></div>

    <section>
        <div class="postto"><input name="postto" type="checkbox" id="postto" value="1" tabindex="6"><label for="postto">Post to my wall</label></div>
        <div class="newsletter"><input name="newsletter" type="checkbox" id="newsletter" value="1" tabindex="7"><label for="newsletter">I want to sign up to the Penguin newsletter</label></div>

        <div class="submit-button"><input name="submitbutton" type="submit" value="enter" tabindex="8"></div>   
        <p class="warning">^ Please fill in the required fields with the correct information.</p>
    </section>
</form>
  • 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-06-11T09:08:45+00:00Added an answer on June 11, 2026 at 9:08 am

    Place the handler you wish to fire on the form.submit(). It will be executed before the form is actually submitted to the webserver.

    See: http://api.jquery.com/submit/

    .submit() is an event just like click, hover, etc. You can bind handlers to it that will be executed before the default action.

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

Sidebar

Related Questions

I have a very simple entry form. After a button is pressed, I need
I have a very simple web form which consists of labels and input fields,
I have a very simple XAML form, that has one namespace definition. For some
So I have 4 pages. They are very simple. index.php (WORKS) <html> <form action=upload.php
I have a very simple fxml file, with a checkbox: ... <AnchorPane id=AnchorPane xmlns:fx=http://javafx.com/fxml
I have a very simple form for data input. Just labels with inputs. But
I have a VERY simple windows form that the user uses to manage Stores.
I have a very simple form where users can enter their email and click
I have very simple form, with input like this: <input id=my_id multiple=true type=file name=image_name[]
Ok, so I have a very simple form with next to no logic in

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.