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 am writing a Catalyst web application that presents some data that does not
I am learning Entity Framework 4. I have a simple ASP.NET (Web Form) application.
I'm doing a web application for articles Articles must be shown by month, with
A long while back I transitioned to doing all my web application development in
I'm doing a performance study for a web application framework running on Apache Tomcat
I've got a .NET 3.5 web application written in C# doing some URL rewriting
I've made a simple Web Application for the iPhone, it's just 6 pages each
We have an in-house application that pulls some data from some of Amazon's pages
The separation between application context and web context (and the class loader issues that
I do primarily web stuff, but I've been playingnaround with a simple windws form

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.