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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:13:51+00:00 2026-05-26T21:13:51+00:00

HOW do i get this to work onsubmit , instead of onclick with a

  • 0

HOW do i get this to work

onsubmit

, instead of

onclick with a button?

I have a form:

    <form id="form"> 
    <label>Email:</label>
    <input type="email" name="email" id="email" class="iput" placeholder="jane@doe.com" reguired="required"/>
    <input type="button" id="nbut" onclick="loadXMLDoc()" value="NEXT">
    </form>

the button works fine to call and process the javascript:

function loadXMLDoc() {

 var xmlhttp; 
 if (window.XMLHttpRequest)   {
    // code for IE7+, Firefox, Chrome, Opera, Safari   
    xmlhttp=new XMLHttpRequest();
 } else {
   // code for IE6, IE5   
   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

 } 
 xmlhttp.onreadystatechange=function()   {   
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
     {      
       document.getElementById('response').innerHTML=xmlhttp.responseText;
       document.getElementById('step1').style.display = "none";
       document.getElementById('step2').style.display = "block";
     }   
 }

 var em = document.getElementById('email'); 
 var em1 = em.value;

 xmlhttp.open("GET","bin/process.php?email="+em1,true); 
 xmlhttp.send();
 }

This only works with a button onclick, I can not get it to work onsubmit and don’t know why..

  • 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-26T21:13:52+00:00Added an answer on May 26, 2026 at 9:13 pm

    onsubmit is a <form> element event.

    You could very simply remove the onclick attribute from the button and change your form to

    <form id="form" onsubmit="loadXMLDoc(); return false;">
    

    The return false prevents the default event handler (form submission) from executing.

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

Sidebar

Related Questions

So I have this form: <form name=login id=login action= method=POST onSubmit=return test()> <input type=text
I'm having a slight problem. I have set my <input type=file> to onChange=this.form.submit() .
This is what I have: <form name=myts method=post action=ts.php enctype=multipart/form-data onsubmit=return upuInit(this)> . .
Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
Anyone know how to get this to work if it's possible? class Foo def
This is crazy, I have been trying for hours to get this to work.
So i have a form, and onsubmit=return reg_check(this) where reg_check() is a javascript function
Im writing a class that replaces all input type=button and input type=submit in the
How does the Model work? I have a Registry Class like this: public class
Is there any chance to get this work? I want my tests to be

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.