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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:22:38+00:00 2026-05-25T10:22:38+00:00

I´m doing a web application, its a simple form in HTML, there is a

  • 0

I´m doing a web application, its a simple form in HTML, there is a button that calls a javascript function to validate the data in the form, but I need call a Servlet if the data is correct.

I have something like this..

<form method="get" id="form" action="ServletForm">
.
.
. 
<input type="submit" value="send" onclick="valiData()">
</form>

the info is validated correctly , but I need to know how can I call the servlet if the data is correct to insert in a database.

  • 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-25T10:22:39+00:00Added an answer on May 25, 2026 at 10:22 am

    The fact that you have a type=”submit” button means it should automatically submit the form (to the URL specified by the form’s “action”) unless you deliberately cancel submission.

    Use the onsubmit event on the form to run your validation. If you return true the submit will proceed, and if you return false it will be cancelled.

    You should use “post” rather than “get” if the submission updates data.

    Try something like this:

    <form method="post" action="ServletForm" onsubmit="return valiData();">
    ...
    </form>
    
    <script>
    function valiData() {
      // validation here
      // presumably some sort of if statement, then
      return true; // if validation passes and you want to submit
      return false; // if validation fails and you want to cancel
    }
    </script>
    

    Note that onsubmit="return valiData();" is the key part to cancel/allow the submission to continue.

    You can also do something similar to cancel/allow the click on the button, but that won’t cover you if the form gets submitted in some other way, e.g., by pressing Enter within a text field.

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

Sidebar

Related Questions

I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been
A long while back I transitioned to doing all my web application development in
I'm starting to re-skill myself in Desktop applications. I've been doing Web applications for
What are the pro/cons of doing web development on your local machine rather than
What tools allows me keep track of tags when doing web development? For example,
I'm looking for a good plugin for doing web front end work in Eclipse.
We're not doing real web development. We get our HTMLs from our designers, and
You are doing contract first development of web services in a SOA world. After
I am doing my best to design my web app with good separation between
I'm doing research into a web API for my company, and it's starting to

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.