• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript window problem

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a page that will output data from a database, this data is displayed in a form.

There are two buttons delete and update, update will allow me to update the database. Delete will delete that data from the database.

The form calls a servlet which will examine the button name and carry out the matching business logic.

I have been asked to add some more logic which when a user presses delete a prompt will be displayed asking are you sure u want to delete the data. This prompt will have two buttons yes and no.

This prompt will need to be displayed when the delete button is clicked but before the servlet is called. Is there any examples of this, and also is there any examples of how javascript builds a prompt containg two buttons.

My experience of java script is very limited.

Thnaks for any help Tony
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted with a simple line of code:

<input type="submit" name = "action" value="Delete" on_click="javascript: return confirm('Wanna delete record?');">

Tony
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


You do not get a choice regarding the button labels. They will be 'OK' and 'Cancel'.
 
reply
    Bookmark Topic Watch Topic
  • New Topic