Wrox Programmer Forums
|
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2008, 06:02 PM
Registered User
 
Join Date: Jan 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sm.ibrahim
Default Confirmation Messagebox

Hi,

this is ibrahim,n im new to this site, joined recently, guys im developing a web site in asp, n got stuck, n im pasting the code below with my problem....

This is my page containing the selected staff details for edit....
-------------------------------------------------------------------
<form method="post" action="update_staff.asp">
<table bgcolor="#b0c4de" border=0 >
<tr>
<thead><input type="hidden" name="name1" value="<%=nm%>"></thead>
<th colspan=2 name="name" align="middle"><%=nm%></th>
</tr><tr>
<td>Telephone #</td>
<td><input type=text name="tel" value="<%=tel%>"></td>
</tr><tr>
<td>Ext #</td>
<td><input type=text name="ext" value="<%=ext%>"></td>
</tr><tr>
<td>Res #</td>
<td><input type=text name="res" value="<%=res%>"></td>
</tr><tr>
<td>GSM #</td>
<td><input type=text name="gsm" value="<%=gsm%>"></td>
</tr><tr>
<td>Email</td>
<td><input type=text name="email" value="<%=email%>"></td>
</tr><tr>
<td>Department</td>
<td><input type=text name="dept" value="<%=dept%>"></td>

<%
rs1.close
conn.close
%>
</tr>
</table>
<br />
<input type="submit" name="action" value="Update" onclick="Call_onclick()">
<input type="submit" name="action" value="Delete">
</td>
</tr>
</table>
</form>
-------------------------------------------------------------------

This this is page for actual updateing the record.....

<%

if nm1="" then
response.redirect "staff-cont-edit.asp"
response.end
END IF

on error resume next
set rs =server.createobject("adodb.recordset")


if Request.form("action")="Save" or Request.form("action")="Update" then
      sql="UPDATE staff_cont SET tel=" & Request.Form("tel") & ","
      sql=sql & "ext=" & Request.Form("ext") & ","
      sql=sql & "res=" & Request.Form("res") & ","
      sql=sql & "gsm=" & Request.Form("gsm") & ","
      sql=sql & "email='" & Request.Form("email") & "',"
      sql=sql & "dept='" & Request.Form("dept") & "' WHERE name='" & nm1 &"';"
      conn.Execute sql
   ' conn.Execute sql,Recordsaffected
      Response.write "<center>Updating..."
      Response.write "<br>"
      Response.write "<img src=""images/loading2.gif"" align=""center""></center>"
elseif Request.Form("action")="Delete" then
   nm1=Request.Form("name1")

   sql="DELETE FROM staff_cont WHERE name='" & nm1 &"'"
   conn.Execute sql
   conn.Execute sql,Recordsaffected
if err > 0 then
   Response.Write("You do not have permission to delete a record from this database!")
else
   Response.Write("Record " & nm1 & " was deleted.")
end if
Response.Write("Deleting records has been disabled from this demo")
end if

conn.close
set conn=nothing

%>

-------------------------------------------------------------

Now the problem is i want to have a confirmation messagebox so before posting the record i want the user choose yes/no for additing the if it is yes then only it should update the record, n if is no then i should cancel the action.... plz help me out dear....



with millions of thanks in advance


with regards
sm ibrahim

With Regards
sm ibrahim
 
Old January 30th, 2008, 12:21 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

first keep button as simple button and not submit
when ever user clicks that button then just call one javascript function as following
function btnupdate_click()
{
    if (confirm('are you sure you want to update'))
    {
          document.frm.submit();
    }
}

urt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirmation with checkbox in gridview collie Visual Studio 2005 0 October 24th, 2007 06:13 AM
Confirmation Pop Up Window Ronb722 Java Basics 0 March 15th, 2006 11:51 AM
Email Confirmation Katachi Dreamweaver (all versions) 1 December 18th, 2005 07:19 AM
delete confirmation yami56 Access 2 April 7th, 2004 12:09 PM
Help..how to make confirmation code shopgirl Classic ASP Databases 1 March 3rd, 2004 02:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.