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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:12:01+00:00 2026-05-28T01:12:01+00:00

I have a simple user account mgmt page, which allows the admin to delete

  • 0

I have a simple user account mgmt page, which allows the admin to delete user accounts.

I want a jQuery UI dialog to popup and halt when the admin user clicks on the “delete” buttton asking for confirmation.

jQuery code:

function getDeleteConfirmation(){
    $( "#dialog:ui-dialog" ).dialog( "destroy" );
    $( "#dialog-confirm-delete" ).dialog({
        modal: true,
        buttons: {
            "Delete": function() {
                      return true;
                      $( this ).dialog( "close" );          
            },
            Cancel: function() {
                      return false;
                      $( this ).dialog( "close" );  
            }
        }

    });}

PHP code:

print "<form action='admin_index.php' method=post>";
print "<input value=".$user_list[$i]."><input type=submit onclick='return getDeleteConfirmation()' value=delete>";
print "</form>";

The problem is that the jQuery dialog window did popup, but instead of halting and waiting for user to react, it soon disappeared. The page got redirected and the user account got deleted.

I then tried to change the code like the follows;

function getDeleteConfirmation(){
    $( "#dialog:ui-dialog" ).dialog( "destroy" );
    $( "#dialog-confirm-delete" ).dialog({
        modal: true,
        buttons: {
               "Delete": function() {
                     window.location = 'admin_index.php';   
                     $( this ).dialog( "close" );
            },
                Cancel: function() {
                     $( this ).dialog( "close" );   
            }
        }
    });

}

and get rid of the form tags in HTML, leave only the input tags

print "<input value=".$user_list[$i]."><input type=submit onclick='return getDeleteConfirmation()' value=delete>";

the jQuery UI dialog window can now halt but whether I click on “Delete” or “cancel”, the corresponding user account didn’t get deleted. It seems to be caused by the php variable didn’t get passed.

I just would like to know how to make this whole thing work properly.

Hope I have made my problem clear and any help is appreciated!

  • 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-28T01:12:02+00:00Added an answer on May 28, 2026 at 1:12 am

    Your problem is that getDeleteConfirmation will return before the dialog can do anything. Things happen like this:

    1. Hit the submit button.
    2. getDeleteConfirmation is called.
    3. The dialog is created.
    4. getDeleteConfirmation returns.
    5. Since getDeleteConfirmation didn’t return false, the standard submit button behavior is triggered.
    6. The form is submitted.

    You need to return false in getDeleteConfirmation to stop the submission. Then you need the Delete button to submit the form. First you need to tell getDeleteConfirmation what form to use and you can do that buy giving it the button:

    <input type="submit" onclick="return getDeleteConfirmation(this)">
    

    Then some adjustments to getDeleteConfirmation:

    function getDeleteConfirmation(button) {
        $("#dialog-confirm-delete").dialog({
            modal: true,
            buttons: {
                "Delete": function() {
                    $(this).dialog("close");
                    $(button).closest('form').submit(); // <--- Trigger the submit.
                },
                Cancel: function() {
                    $(this).dialog("close");
                }
            }
    
        });
        return false;  // <--- Stop the submit.
    }
    

    Demo (with non-functioning form so you’ll get an error when you submit it): http://jsfiddle.net/ambiguous/kGSCk/

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

Sidebar

Related Questions

I have a simple User Account application in which the user is able to
I have a simple databasescheme: User, Account. User has 1-to-many relationship with Account. I
I have a simple Desktop Facebook application that allows the user to retrieve some
I have a simple application in which I need to let the user select
I have a simple form on a view page, implemented as a user control,
I have a simple page with images, and when the user clicks the image,
I have a simple table view which is editable. All I need the user
I have a simple create user wizard and custom membership provider which was taken
I have a non-Drupal site which authenticates with a simple MySQL user database. I
We have a simple database. The User table holds users. The Accounts table holds

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.