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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:30:51+00:00 2026-06-06T05:30:51+00:00

I have two simple submit buttons on my form, which work just fine: <button

  • 0

I have two simple submit buttons on my form, which work just fine:

<button id="accept" type="submit" name="accept" value="accept">Accept</button>
<button id="decline" type="submit" name="decline" value="decline">Decline</button>

However, the page in question you can either view by going directly to the URL, or it is occasionally displayed in a modal dialog, which I have setup using the following jQuery:

dialog.dialog({
    buttons: [
        {
            text: "Decline", click: function() {
                $('#decline').click();
                dialog.dialog('close');
            }
        },
        {
            text: "Accept", click: function() {
                $('#accept').click();
                dialog.dialog('close');
            }
        }
    ]
});

dialog.load(url + '&ajax=1');

This submits the form just fine, and it detects all post information apart from the element that was actually clicked. So for example, if you load the form, and click the #decline button, that information will be posted, this isn’t the case with jQuery.

Thanks

  • 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-06-06T05:30:54+00:00Added an answer on June 6, 2026 at 5:30 am

    Careful with dialogs as they don’t make your submit action from your inputs wait. As soon as you click the submission is triggered.
    You should use inputs of type button instead of submit and manage yourself the submission with the $(form).submit() method. It might solve your problems

    EDIT: to answer your comment:

    <style>
    .submitbutton{
        text-align:center;
        font-weight:bold;
        /* you can do whatever you like here */
    }​
    </style>
    <div id="dialog"></div>
    <form id="myform">
    <input id="accept" class="submitbutton" type="text" value="Accept button" name="accept" value="accept"/>
    <input id="decline" class="submitbutton" type="text" value="Decline button" name="decline" value="decline"/>
    
    </form>​
    <script>
    $('#accept,#decline').click(function(e){
        alert('you clicked #'+$(this).attr('id'));
        //you can do whatever you want here as you know which button was pressed.
        // to add more information in your form :
        $('#myform').append($("<input>").attr("type", "hidden").attr("name", "newhiddendata").val("something"));
        $('#myform').submit();
    });
    
    var dialog= $('#dialog');
    dialog.dialog({
        modal:true,
        buttons: [
            {
                text: "Decline", click: function() {
                    dialog.dialog('close');
                    $('#decline').click();
    
                }
            },
            {
                text: "Accept", click: function() {
                    dialog.dialog('close');
                    $('#accept').click();
                }
            }
        ]
    });
    ​
    </script>
    

    http://jsfiddle.net/techunter/KPu7G/

    this is really raw, no css at all but you see the point.

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

Sidebar

Related Questions

I have a very simple form with a name field and two submit buttons:
I have a form with two buttons, a submit button and a cancel/close button.
I have two buttons inside a form call: <% using (Html.BeginForm()) {%> <input type=submit
I want to use a form that has two submit buttons. Each button calls
I have a simple form with two fields and an optional field which is
Let's assume I have a very simple form, with a submit button and a
I've got a FORM which contains a 32*50 TEXTAREA and a Submit button. Now
I have a simple form with some radio buttons. I want to disable some
I have a form and two command buttons. I want that on pressing the
I did a simple rails form with two user inputs , name and email.

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.