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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:08:13+00:00 2026-05-29T04:08:13+00:00

My form submits to another page when I do not want it to. The

  • 0

My form submits to another page when I do not want it to. The current page is known as create_session.php

I want the form to submit if all of the validation and the postback is met and even after that the user needs to click “Ok” when the confirmation box appears. Except this never happens. When the user clicks on the submit button, it takes the user straight to another page “QandATable.php”, it doesn’t care about about validation(), the postback() and the confirmation box doesn’t appear.

So what I want to know is that when the user clicks on the submit button, how can I get it so that it checks for the validation(), postback() and confirmation box (showConfirm()) before even going onto the next page.

I believe the problem is the submit button and the form action. Below is the form:

    <form action="QandATable.php" method="post" id="sessionForm">

<p><input type="text" id="txtMarks" name="textMarks" onkeypress="return isNumberKey(event)" maxlength="5" /><br/><span id="marksAlert"></span></p>
<p><strong>Room:</strong> <input type="text" id="room" name="roomChosen" value="<?php echo $roomChosen; ?>" />
                <br/><span id="roomAlert"></span></p>      <!-- Enter Room here--> 

<p><input class="questionBtn" type="submit" value="Prepare Questions" name="prequestion" onClick="myClickHandler()"/></p> 
</form>

Below is the javascript click handler where it checks for the validation(), postback() and then if both of those met then it will showConfirm().

function myClickHandler(){ 
     if(validation()){ 
        postback(function(message) { 
            if (message == "") 
                showConfirm(); 
        }); 
     } 
} 
  • 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-29T04:08:14+00:00Added an answer on May 29, 2026 at 4:08 am

    You need to make sure the default action isn’t applied when the submit button is clicked. In this case, the default action is to submit the form.

    Try adding a return false; such as

    <input class="questionBtn" type="submit" value="Prepare Questions" name="prequestion" onClick="myClickHandler(); return false;"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to intercept form submits from webpages I dont control. My current
My below mentioned code still submits form on special character in name field. Validation
i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect
I have a form in index.php <?php echo '<form action=update_act.php method=POST>'; echo '<input type=submit
I am loading a registration form from another page. The load works great. I
After a new user submits a 'New account' form, I want to manually log
I have a php page that contains a form with information I post to
I want to create a invisible form anywhere into a HTML page dynamically using
I'm basically just trying to submit a form through AJAX and want to show
I'm trying to nest a form within another using submit_to_remote but it does a

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.