| Author |
2 jsp buttons
|
Tracy Zoller
Greenhorn
Joined: Dec 11, 2002
Posts: 4
|
|
I am outputting to the screen rows of data followed by 2 buttons, edit and delete. When the edit button is clicked the user should be asked if they want to edit the existing record or if they want to add a new record. If they choose to edit the existing record, the page will be forwarded to a screen where the user can edit data, if they choose to add a new record, the page will be forwarded to a screen where the user can enter a new record. For the delete button, the user should be asked "Are you sure you want to delete this record?" If yes, record will be dumped into a deleted records table in the database. If no, keep focus on initial screen. Can anyone help me with this? I am desperate. Thanks in advance. My code is as follows:
|
 |
Yuriy Fuksenko
Ranch Hand
Joined: Feb 02, 2001
Posts: 411
|
|
remove underscore in ONCLICK: <input name="Delete" type="button" id="Delete" value="Delete" on_click="if(confirm('Are you sure?')) this.form.submit();">
|
 |
David O'Meara
Rancher
Joined: Mar 06, 2001
Posts: 13459
|
|
OK then. Firstly, is it possible to make a part of the data a link? That way each record has a link that can be selected to act as the 'Edit' functionality. Then you no longer need the Edit button as such. In theory you can manage the delete in the same way. Obviously this will cause each operation to be executed as a HTTP GET method. If you need to post the data, have a (single) separate form with a dummy variable. When the user clicks the links, run some JavaScript to set the UID on the dummy variable (depending on the link selected) and submit the form. The other way to manage delete functionality is to have a checkbox for each row and a single delete button. The delete button causes all of the selected items to be submitted to the delete servlet for processing. Hope this helps. Dave
|
[ JavaRanch FAQ ][ Book Promotions ][ DbTamer ][ BumperStickers ][ JavaRanch Badges ]
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 12513
|
|
Also check out the Model 2 design approach. It's more complex than doing everything in JSPs but scales better. You might even want to check out my Intro to Struts.
|
One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
|
 |
 |
|
|
subject: 2 jsp buttons
|
|
|