confirmation of a delete

Results 1 to 3 of 3

Thread: confirmation of a delete

  1. #1
    CousinIT Guest

    Default confirmation of a delete

    I have a form with a button in it. <BR>When the button is clicked I would like a confirmation box to appear then, if the user clicks yes for a new page to be displayed with a server side script run to delete something. <BR>If the user clicks no I want nothing to happen and to stay on the page i am on.<BR><BR>Am I going about this the right way?<BR><BR>&#060;SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript&#062;<BR>Sub studentdelete_onclick<BR> iret = msgbox ("This will delete the student " & vbcr &"Are you sure you wish to continue?",vbyesno)<BR> if iret= vbyes then<BR> &#039;open 1.asp nb. "1.asp","_self" does nothing if i have the form action set or not set.<BR> else<BR> &#039;do nothing<BR> end if<BR>End Sub<BR><BR>&#060;form action="1.asp" method="POST" name="del" target="_self"&#062;<BR> &#060;INPUT TYPE="HIDDEN" NAME="siddel" VALUE=&#060;%=Request.QueryString.Item("student")% &#062;&#062; <BR> &#060;input type=submit value=&#039;Delete Student&#039; name=&#039;studentdelete&#039;&#062;<BR>&#060;/form&#062;<BR><BR>&#039;************************** **********************************************<BR>[1.asp]<BR><BR>&#060;%<BR>Set OBJdbConnection = Server.CreateObject("ADODB.Connection") <BR>OBJdbConnection.Open session("CampusSQL_ConnectionString")<BR><BR>&#039 ;sub deleteStudent()<BR> &#039;on error resume next<BR> If Not IsEmpty(Request.Form) Then<BR> if Request.Form.item("siddel") &#060;&#062; "" then<BR> sql = "delete from studentrec "<BR> sql = sql & "where student_id = &#039;" & Request.Form.item("siddel") & "&#039; " <BR> OBJdbConnection.execute sql<BR> end if<BR> end if<BR> %&#062;<BR><BR>&#060;html&#062;

  2. #2
    J Guest

    Default RE: confirmation of a delete

    In Visual Basic vbYes has a value of 6. So...<BR>Dim intConfirm<BR>intConfirm = msgbox("Do you want to delete?, vbYesNo")<BR>If intConfirm = 6 Then<BR><BR>Else<BR><BR>End If<BR><BR><BR>I am assuming this will work the same in VBScript. You can also use javascript confirm() - which will return a boolean value. Hope this helps.<BR><BR>J

  3. #3
    CousinIT Guest

    Default RE: confirmation of a delete

    thx, i was trying that with no luck, but I found this worked using the onsubmit event<BR>function del_onsubmit<BR> iret = msgbox ("This will delete the student" & vbcr &"Are you sure you wish to continue?",vbyesno)<BR> if iret = vbYes then<BR> del_onsubmit = true<BR> else<BR> del_onsubmit = false<BR> end if<BR>End function<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts