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

  • Home
  • SEARCH
  • 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 6128473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:37:51+00:00 2026-05-23T16:37:51+00:00

I am getting the form on click from a file called test.php which contains

  • 0

I am getting the form on click from a file called test.php which contains the following:

<form method="post" class="adminTM">
    <input type="hidden" name="execID" value="<?=$_POST['exec']?>" />
    <input type="hidden" name="fromTM" value="<?=$_POST['TM']?>" />
    <input type="text" name="toTM" value="<?=$_POST['TM']?>" />
    <input type="hidden" name="symbol" value="<?=$_POST['symbol']?>" />
    <button class="submitTM">SUBMIT</button>
</form>

The javascript looks like so:

$(function(){

    $('.adminTMClick').live('click', function(e){
        $(this).data('TM', this.innerHTML);
        $.post('test.php', $(this).data(), function(data){
            $(data).dialog({
                modal: true,
                beforeClose: function(){
                    $(this).remove();
                }
            });
            console.log($('.adminTM'));
            console.log($('.submitTM'));
        });
    });

    $('.submitTM').live('click', function(e){ 
        //originally had .adminTM with submit which failed
        e.preventdefault();
        alert('i am here');
        return false;
    });

});

How do i make it so that the form DOES NOT do the default submit action when the submit button is clicked?

Here is a fiddle that demonstrates basically what I am doing (i had to change it a bit because of the way jsfiddle works): http://jsfiddle.net/maniator/tQVnV/show/

  • 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-23T16:37:52+00:00Added an answer on May 23, 2026 at 4:37 pm

    You should use the submit() event on the form instead of the click() on the submit, since pressing enter will still submit the form (bypassing the submit button).

    This should properly prevent the form from doing the default submit:

    $('.adminTM').live('submit', function(e) {
        // execute custom code
        console.log("submit event fired");
    
        // prevent default submit
        return false;
    });
    

    jsFiddle: http://jsfiddle.net/bjorn/tQVnV/11/

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

Sidebar

Related Questions

I am having problems getting my form to Post to my Save method in
I'm trying to learn from the http://jquery.malsup.com/form/#getting-started example. When I click submit, the alert
<div id = 'eventcontainer' > <span id = 'class'> <?php //Getting posts from DB
how can i getting data from listbox in second form named listform while i
I have Ajax file in which code has written to accept values form user
I currently have a registration form which when clicked from a link opens up
We have a complete code for getting the values from PHP through Jquery AJAX
I have designed one sign-up form,in this form after getting all necessary values I
Getting a rendering error for this form: 'NoneType' object has no attribute 'widget' http://dpaste.com/88585/
I started getting this error when posting the form back with Model Binder. 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.