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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:25:48+00:00 2026-05-30T12:25:48+00:00

<form action =/submit-page/ method=’post’ class=editable> <fieldset> <select name=status id=’status’> <option value=Submitted>Submitted</option> <option value=Canceled>Canceled</option> <option

  • 0
<form action ="/submit-page/" method='post' class="editable">
    <fieldset>
    <select name="status" id='status'>
        <option value="Submitted">Submitted</option>
        <option value="Canceled">Canceled</option>
              <option value="Application">Application</option>
    </select>
          <input type="submit" name="submit" value="SAVE">

</form>

I have a form above: When I click on the drop down value “Canceled” and hit the Save button I want to give alert box with a warning message with a Yes and No button.

If the user cicks on Yes, take him to the submit-page as desired in the form action parameter.
if the user clicks No, stay on the same form page without refreshing the page.
Can this be done in jQuery?

  • 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-30T12:25:49+00:00Added an answer on May 30, 2026 at 12:25 pm

    Hmm… theres is a problem with the other answers on here: they don’t work against your HTML.

    There’s a bug in jQuery (I assume it’s a bug), where if an element on your form has aname of submit, then triggering the submit event of the form will not work.

    You will need to remove the name attribute from your input type="submit" button or simply give it a name other than “submit”.

    HTML

    <form action ="/submit-page/" method='post' class="editable">
      <fieldset>
        <select name="status" id='status'>
          <option value="Submitted">Submitted</option>
          <option value="Canceled">Canceled</option>
          <option value="Application">Application</option>
        </select>
        <input type="submit" value="SAVE" name="submit-button"/>
      </fieldset>
    </form>​
    

    jQuery

    $('#status').on('change', function() {
    
        var $this = $(this),
            val = $this.val();
    
        if (val === 'Canceled' && confirm("are you sure?")) {
            $this.closest('form').submit();
        }
    });​
    

    PHP

    $submitted = !empty($_POST['submit-button']);
    
    if($submitted)
    {
        // Submit button was pressed.
    }
    else
    {
        // Form was submitted via alternate trigger.
    }
    

    Example

    Working: http://jsfiddle.net/xixonia/KW5jp/

    Not Working: http://jsfiddle.net/xixonia/KW5jp/1/

    Edit

    You have since updated your question, and this answer is no longer a valid solution for what you are looking for. Instead, look at Chris Platt’s answer.

    Edit Again

    This is a modified version of Chris Platt’s answer. It simply waits until the DOM is ready (elements are loaded) before it executes the logic contained within the first $(...).

    $(function() { // this first jQuery object ensures that...
    
        /// ... the code inside executes *after* the DOM is ready.
    
        $('form.editable').submit(function(){
            if ($('#status').val()=='Canceled') {
                if (!confirm('Warning message here. Continue?')) {
                    return false;
                }
            }
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$('form').submit(function(){ this.action=http://www.sitename.com/post; return false; }); having altered the action attribute of the form ,i
I am trying to submit a form with method GET and action index.php?id=3. The
I've been trying to submit a form with the FormPanel using the Action class
I got this code in my submit form <form id=myform action='hello.php' method='GET'> <input type=button
I'm new to coldfusion. I have page called test1.cfm <form action = test2.cfm method
I have an Action method in an ASP.NET MVC Controller class that handles form
it it possible to get the form action of a GET form on submit
I would like to have a form that can submit to two different action
I have a form which users must fill out and submit. The controller action
I have a form action that needs to have its value set from 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.