Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 29th, 2008, 06:02 PM
Registered User
 
Join Date: Jan 2008
Location: Ruwi, Ruwi, Oman.
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
  #2 (permalink)  
Old January 30th, 2008, 12:21 AM
Friend of Wrox
 
Join Date: Oct 2007
Location: , , .
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
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirmation with checkbox in gridview collie Visual Studio 2005 0 October 24th, 2007 07: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 01:09 PM
Help..how to make confirmation code shopgirl Classic ASP Databases 1 March 3rd, 2004 02:09 PM



All times are GMT -4. The time now is 02:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.