Advertisement

07.28.2005 at 12:23PM PDT, ID: 21508135
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

confirm delete

Asked by dirklance in JavaScript

Tags: , ,

greetings,

i'm trying to write a function that i can pass a record ID to then pop a confirm box asking whether they really want to delete the record, if yes then  window.location.replace the querystring w/ the id to the delete.asp page.

heres the funtion thus far.  the only problem is it deletes the first record always.
<script language="JavaScript">
      <!--
            function confirm_entry()
            {
            input_box=confirm("Are you sure you want to delete this product?");
            if (input_box==true)

            {
            // Output when OK is clicked
             window.location.replace("deleteProduct.asp?fProdID=<%=objRs("prodID")%>&fAcctNo=<%=request.querystring("fAcctNo")%>")

            }

                  else
                  {
                  // Output when Cancel is clicked
                  alert ("Delete Cancelled");
                  }

            }
      -->
</script>


heres the link they click on to delete
<a href="javascript:confirm_entry()"><img src="Images/btn_delete.gif" border="0" /></a>


link to project http://www.luminopolis.com/x/ADMIN/products.asp?fAcctNo=3
and heres the full code if needed.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
      <title>luminopolis store admin</title>
<META NAME="Author" CONTENT="?">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type='text/javascript' src='Includes/expandContent.js'></script>
<style type="text/css">
<!--
a:link {color:#999999;text-decoration:none;}
a:visited {color:#999999;text-decoration:none;}

a:hover {color:#ff9900;text-decoration:underline;}
a:active {color:#ff9900;text-decoration:none;}
body{margin:0;padding:0;color:#666666;}
table,div, select, input, textarea{font-family:verdana,tahoma,times;font-size:10px;}

//-->
</style>
</head>
<body>
<!-- METADATA TYPE="typelib" FILE="C:\program files\common files\system\ado\msado15.dll" //-->

<CENTER><br /><br /><br />
            <div style="width:800px;text-align:left;">
<table width="800">
      <tr>
            <td width="50%"><span style="font-size:17px;color:#003366;font-weight:bold;">Products</span></td>
            <td width="50%" align="right"><img name="nav" src="Images/nav.gif" width="350" height="33" border="0" usemap="#nav" alt=""><!-- #include file="Includes/nav.asp" //--></td>
      </tr>
</table><br />
<hr style="color:#000000;width:100%;size:1px;">
<br />

<div style="cursor:pointer;cursor:hand;" onClick="expandcontent('sc1')">+ <b>Add an Item</b></div>
                  <div id="sc1" class="switchcontent">
                  <span>
                        <form action="addProduct.asp" method="get" />
                        <input type="hidden" name="fAcctNo" value="<%=request.querystring("fAcctNo")%>" />
                              <table width="100%">
                                    <tr>
                                          <td bgcolor="#cccccc" align="right" colspan="3">&nbsp;</td>

                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Name</b>: </td>
                                          <td bgcolor="#e7e7e7"><input type="text" name="fProdName" value="" size="44" /></td>
                                          <td bgcolor="#e7e7e7" style="color:#666666;">&nbsp;</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Item No.</b>: </td>
                                          <td bgcolor="#f6f6f6"><input type="text" name="fProdItemNo" value="" size="44" /></td>
                                          <td bgcolor="#f6f6f6" style="color:#666666;">&nbsp;</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Price</b>: </td>
                                          <td bgcolor="#e7e7e7">$<input type="text" name="fProdPrice" value="" size="43" /></td>
                                          <td bgcolor="#e7e7e7" style="color:#666666;">USD</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Description</b>: </td>
                                          <td bgcolor="#f6f6f6"><textarea name="fProdDesc" cols="43" rows="13"></textarea></td>
                                          <td bgcolor="#f6f6f6" style="color:#666666;">&nbsp;</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Category</b>: </td>
                                          <td bgcolor="#e7e7e7"><input type="text" name="fProdCategory" value="" size="44" /></td>
                                          <td bgcolor="#e7e7e7" style="color:#666666;"><b>HINT:</b> Add an 's' to the end of your Category names.</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Weight</b>: </td>
                                          <td bgcolor="#f6f6f6"><input type="text" name="fProdWeight" size="44" /></td>
                                          <td bgcolor="#f6f6f6" style="color:#666666;">&nbsp;</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Options Available</b>: </td>
                                          <td bgcolor="#e7e7e7"><textarea name="fProdOptions" cols="43" rows="13"></textarea></td>
                                          <td bgcolor="#e7e7e7" style="color:#666666;"><b>IE:</b><br />Red // XL<br />Black // L<br />Black // M<br />Rose Scent // 32oz<br />Rose Scent // 16oz<br /><br /><b>Please seperate combos with a line break [enter].</b></td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Handling Charge</b>: </td>
                                          <td bgcolor="#f6f6f6">$<input type="text" name="fProdHandling" value="" size="43" /></td>
                                          <td bgcolor="#f6f6f6" style="color:#666666;">If this product must ship in its own box or is oversized, enter the shipping amount to charge (per item bought) here.</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#ccff99" align="right"><b>Contact Override</b>: </td>
                                          <td bgcolor="#e7e7e7"><input type="radio" name="fContactOver" value="1" /> Contact Override</td>
                                          <td bgcolor="#e7e7e7" style="color:#666666;">If you DO NOT want this item to be ordered online and wish for the customer to call for details check this box</td>
                                    </tr>
                                    <tr>
                                          <td bgcolor="#cccccc" align="right" colspan="2"><input type="submit" value="Add Item" /></td>
                                          <td bgcolor="#cccccc">&nbsp;</td>
                                    </tr>

                              </table>
                        </form>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                  </span>
                  </div>
      <br /><br />


            <table style="width:100%;">
                  <tr>
                        <td>
                              <table style="width:100%;">
                                    <%
Dim acctNo, prodID, prodName, prodSizeColorAvail, prodDesc, prodItemNo, prodCat, prodShipHandling, C, bgColor, cat, lastCat, options, optionsF

      acctNo = request.querystring("fAcctNo")

Dim SQL, objConn, objRs

Set objConn = Server.CreateObject("ADODB.Connection")
      Set objRs = Server.CreateObject("ADODB.Recordset")

SQL = "SELECT * FROM [products] WHERE prodAcctNo = '" & acctNo & "' AND prodImgType <> '' ORDER BY prodCat"

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Domains\luminopolis.com\db\x\icarusMerch.mdb;" & "Persist Security Info=False"

objRs.Open SQL, objConn, adOpenForwardOnly, adLockReadOnly


%>

<script language="JavaScript">
      <!--
            function confirm_entry()
            {
            input_box=confirm("Are you sure you want to delete this product?");
            if (input_box==true)

            {
            // Output when OK is clicked
             window.location.replace("deleteProduct.asp?fProdID=<%=objRs("prodID")%>&fAcctNo=<%=request.querystring("fAcctNo")%>")

            }

                  else
                  {
                  // Output when Cancel is clicked
                  alert ("Delete Cancelled");
                  }

            }
      -->
</script>

<%

If objRs.eof then
      response.write "<tr><td colspan='3'>NO RESULTS FOUND</td></tr>"
else

      While Not objRs.EOF

cat = objRs("prodCat")

      If C Mod 2 = 0 Then
                  isEven = True
            Else
                  isEven = False
            End If

            If isEven = False Then
                  bgColor = "e7e7e7"
            Else
                  bgColor = "f6f6f6"
      End If
%>
                  <tr>
                        <TD colspan="3" align="right">
<%

If cat = lastCat then
%>

<%
else
%>
<span style="font-size:17px;font-weight:bold;color:#ff9900;"><%=cat%></span>
<%
end if





%>

                  </td>
                        </tr>
                        <tr bgColor="<%=bgColor%>" onmouseover="this.bgColor='#ccff99'" onmouseout="this.bgColor='<%=bgColor%>'">
                              <td align="center"><input type="hidden" name="fProdID" value="<%=objRs("prodID")%>" /><img src="http://www.luminopolis.com/cgi-bin/x/prodImages/<%=objRs("prodID")%><%=objRs("prodImgType")%>" width="100" height="100" /><br /><br /><a href="upload/product/uploadF.asp?fProdID=<%=objRs("prodID")%>&fAcctNo=<%=request.querystring("fAcctNo")%>"><img src="Images/btn_changeImage.gif" border="0" /></a></td>
                        <td style="padding:5;">
                              <b><%=objRs("prodName")%></b><br /><BR />

                              <%=objRs("prodDesc")%><br /><br />
                              <b>$</b><%=objRs("prodPrice")%><br />
                              <b>Options:</b> <% if objRs("prodSizeColorAvail") = "" then response.write "N/A" else response.write replace(objRs("prodSizeColorAvail"), "_", " * ") end if%><br />
                              <b>#</b> <%=objRs("prodItemNo")%><br />
                              <b>Category:</b> <%=objRs("prodCat")%><br />
                              <b>Handling Charge:</b> <%=objRs("prodShipHandling")%><br />
                              <b>Contact Override</b> <%if objRs("prodContactOverride") = "1" then response.write "ON" else response.write "OFF" end if%><br /><br /><a href="editProduct.asp?fProdID=<%=objRs("prodID")%>&fAcctNo=<%=request.querystring("fAcctNo")%>"><img src="Images/btn_editInfo.gif" border="0" /></a></td>
                              <td align="center"><a href="javascript:confirm_entry()"><img src="Images/btn_delete.gif" border="0" /></a></td>
                        </tr>

<%
      lastCat = objRs("prodCat")
      C = C + 1
            objRs.MoveNext
      Wend

      End If

      objRs.Close
      objConn.Close
      Set objRs = Nothing
      Set objConn = Nothing
%>
                  </table>
            </td>
      </tr>

</table>
<br /><br /><hr style='color:#000000;width:100%;size:1px;'></div>
<br /><br /><br />
<center><!-- #include file="Includes/bNav.asp" //--><br /><br /></center>

</body>
</html>

Start Free Trial
[+][-]07.28.2005 at 12:47PM PDT, ID: 14549331

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: javascript, confirm, delete
Sign Up Now!
Solution Provided By: dorward
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.28.2005 at 01:23PM PDT, ID: 14549689

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2005 at 01:56PM PDT, ID: 14550001

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-38