Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem asking for confirmation before excecuting an action

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!

I've been around this forum for a while and you people have saved me a lot of times (thanks by the way), but this time I haven't found any answer to my specific problem, so I'm opening this new thread.

The situation is as follows: In my web app I have a "delete" link, which calls an action to do the work, it looks like:

It works like a charm. But I would like to ask before deletion.

My idea is to use jquery jConfirm().

I have this js function:

and my modified struts tag

The result of all this is:

1) on click, appears the confirm dialog.
2) about 1 sec after (before I can even choose an option on the dialog) the browser takes me automatically to "./"

If I go back on my browser, the previous page loads with the confirm dialog, this time it waits for a choose and it does exactly what it has to do.

My problem is, as you can see, that "go without confirm".

I've tried with a simple html tag

In this case it waits, but won't send the appropriate values to the js function since it sends literaly "%{name}" and "%{id}".

PS this is my first "real word job" so I might be asking for a text book situation (if that's the case, please point me to the text book)

Thanks in advance
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Edgar,
I am not quite sure about struts2 tags but his is how i can see your problemThis line of code is trying to do 2 things asynchronously.
1. On Click event
2. href event.
removing either of them would work fine. I prefer you remove onclick and retain href. Try the below piece of code and see if it works out.
Edgar Rms
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works like a charm.

Thanks a lot

"live another day and learn another thing"
    Bookmark Topic Watch Topic
  • New Topic