This topic is locked
[SOLVED]

 JSP confirm deletion page

6/14/2004 12:15:47 PM
ASPRunnerPro General questions
author

Hi, when a user wishes to delete a record from an access database, I understand the "promp" to confirm delete a record was already built into the generator, but I want it to take the user to the view page before it confirms delete so the user can review the entire record info again before it deletes (view page would be a good place for the user to review the record info again) how do I do that? Please help
the current code included after the generator generates the code:
<a href=# onClick = "var i; bSelected = !bSelected; for (i=0;i<document.forms.deleteform.mdelete.length;++i) document.forms.deleteform.mdelete[i].checked=bSelected;">Select/Unselect all</a>

&nbsp;&nbsp;

<a href="#" onClick="if (confirm('Do you really want to delete these records?')) { document.forms.deleteform.submit(); return false; } else {return true;}">Delete selected</a>

Sergey Kornilov admin 6/16/2004

Kevin,
I'm not really sure how do you like to deal with multiple selection however this is the sample code (see my changes in bold) that will redirect user to the view page instead of deleting record.

<a href=# onClick = "var i; bSelected = !bSelected; for (i=0;i<document.forms.deleteform.mdelete.length;++i) document.forms.deleteform.mdelete[i].checked=bSelected;">Select/Unselect all</a>

&nbsp;&nbsp;

<a href="#" onClick="java script: document.forms.editform.TargetPageNumber.value=<%=mypage%>;

document.forms.editform.editid.value = '<%=EscapeQuotes(rsData(strKeyField))%>';

document.forms.editform.action.value = 'view';document.forms.editform.submit();

return false;"
>Delete selected</a>

500135 6/16/2004

Hi, I tried your code
<a href="#" onClick="java script: document.forms.editform.TargetPageNumber.value=<%=mypage%>;

document.forms.editform.editid.value = '<%=EscapeQuotes(rsData(strKeyField))%>';

document.forms.editform.action.value = 'view';document.forms.editform.submit();

return false;">Delete selected</a>
but its giving the following error
Error Type:

Microsoft VBScript runtime (0x800A000D)

Type mismatch: 'rsData'

/mvsmaint_list.asp, line 382
POST Data:

TargetPageNumber=1&SQL=select+%5BUserCode%5D%2C+%5BRecord+ID%5D%2C+++%5BDate+Requested%5D%2C+++%5BRequested+By%5D%2C+++%5BPhone+EXT%5D%2C+++%5BRequested+Maintenance+Tested%5D%2C+++%5BMaintenance+Reque . . .
also, if I don't care about deleting multiple records, how do I add a "confirm delete" button on that view page once the user is redirected? Please help, thank you

Sergey Kornilov admin 6/18/2004

Kevin,
unfortunately I cannot give you working code. Here is the basic idea how to implement this:

  1. Change Delete selected link to submit editform instead of deleteform. That would be something similar to code snippet from my previous post.
  2. Change View page (or create a new page for this purpose) to recognize this situation and add Delete button there.
  3. Move code that deletes record from the list page to the view page.