Click to See Complete Forum and Search --> : Coding problem here!!


ToMo
02-04-2004, 06:59 PM
Ok, I have an ASP page that draws a table with a recordset, each record being a table row. I want to add a last column in the table that will have a remove link that when clicked will pop up a confirm box and if clicked ok, will update a field in the record and will redraw the table without that record. I have the code to do the confirm box in javascript, I just have no idea how I would pass the unique id to another asp page that would handle the database update. Im pretty sure you can't embed ASP inside of a javascript. Any suggestions?

Here is the javascript i was trying to use:

<script language="JavaScript">
<!--
function confirm_entry()
{
input_box=confirm("Click OK or Cancel to Continue");
if (input_box==true)

{
// Output when OK is clicked
alert ("Pending Certificate Canceled");
window.location="remove_pend.asp?id=idunnowhattodohere!"
}

else
{
// Output when Cancel is clicked
alert ("You clicked cancel");
}

}
-->
</script>
<td bgcolor="#EEEEEE" style="color:black;"><font style=""color:#0000CC; text-decoration:none;""><a href="JavaScript:confirm_entry()">Remove</a></font></td>

kid A
02-04-2004, 07:18 PM
Can't you just pass the record ID to the JS function, then append it to the window.location="remove_pend.asp?id=idunnowhattodohere in place of idunnowhattodohere?

You can pass pretty much anything to a function:

<a href="JavaScript:confirm_entry('<%recordId%> ')">Remove</a>

Then use it in your function like this:

function confirm_entry(recordId)
{
input_box=confirm("Click OK or Cancel to Continue");
if (input_box==true)

{
// Output when OK is clicked
alert ("Pending Certificate Canceled");
window.location="remove_pend.asp?id=recordId"
}


Is this what you mean?

ToMo
02-04-2004, 07:46 PM
Ok, i figured it out!! All I had to do was after -window.location="remove_pend.asp?id=
i just added <%= rs("CertId")%>"

ie -window.location="remove_pend.asp?id=<%= rs("CertId")%>"

Thanks for the help Kid A :D