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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:28:56+00:00 2026-05-27T03:28:56+00:00

I wish to have a confirmation on a delete button, and am attempting to

  • 0

I wish to have a confirmation on a delete button, and am attempting to do it all in one line… this is the regular onClick event without the delete confimration:

onClick='this.form.action="/Config?pg=FIBiller&cmd=delete";'    

I found online that a confirm delete can be implemented as such:

"return confirm('Are you sure you want to delete?')"

How can I incorporate this into my onClick event so it’s one line, don’t want to use more javascript? If I must do so, than how would I incorporate the action for a “yes” on the message box in the javascript function?

  • 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-27T03:28:56+00:00Added an answer on May 27, 2026 at 3:28 am

    If I understand you correctly, you just want

    <form action="/Config?pg=FIBiller&amp;cmd=delete">
        <input type="submit" value="delete" onclick="return confirm('Are you sure you want to delete?')" />
    </form>
    

    Or if you really can’t change your form as such for some unclear reason (bad design maybe?), then you need to introduce an if-else block as follows which changes the form’s action on confirmation and returns false on cancel.

    <input type="submit" value="delete" onclick="if (confirm('Are you sure you want to delete?')) form.action='/Config?pg=FIBiller&amp;cmd=delete'; else return false;" />
    

    Note: if you want to add more calls or want to improve readability, introduce braces:

    <input type="submit" value="delete" onclick="if (confirm('Are you sure you want to delete?')) { form.action='/Config?pg=FIBiller&amp;cmd=delete'; } else { return false; }" />
    

    Unrelated to the concrete problem, I’d suggest to get rid of cmd=delete as you could also just check that by giving the delete button a name so that it will be sent as request parameter as well:

    <input type="submit" name="delete" value="delete" ...>
    

    you could then check as follows in the JSP/Servlet side if it’s been pressed:

    if (request.getParameter("delete") != null) {
        // Delete button is pressed.
    }
    

    By the way, deleting by GET is a bad idea. Rather use POST. Otherwise all delete links will be executed when a searchbot comes along your website and crawls all GET links/actions without executing JavaScript. You also don’t want the resulting delete requests to be bookmarkable, right?

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

Sidebar

Related Questions

I wish to have long and short forms of command line options invoked using
I wish to have a page that has a fixed height (without scroll bars).
I have two simple related controls on a form, a delete button and a
I wish to have the following: <span title=This is a good title.>Catch me in
I have some StackPanels I wish to have the same Width. However this should
I wish to have an NSView with one side of it fading out to
Hi i have a tab load this usercontrol. when i wish to close this
I wish to have a submit button (for the default form action), and an
I wish to have a small dialog based application which is passed command line
Good afternoon, I wish to have a script that will look for all files

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.