Using a java script comfirmation in delete record function?


hello;
i trying write confirmation script in java delete record. don't want delete whole table of information, record teh delete button attached using id. here script, , code on page:

<script language="javascript">
function confirmdelete(id) {
if (confirm ("are sure want delete record?"))
{
document.href.action="projectcat-action.cfm?id="+id;
document.href.submit();
}
return false;
}

</script>

here query trying use with:
<cfquery name="catman" datasource="#sitedatasource#" username="#siteuserid#" password="#sitepassword#">
select categories.name viewfield1, categories.categoryid id
categories
</cfquery>
<head>
</head>
<body>
<cfloop query="catman" startrow="#url.startrow#" endrow="#endrow#">
<cfoutput>
#viewfield1#
<form action="projectcat-action.cfm" method="post">
<input type="hidden" name="id" value="#id#">
<input type="submit" name="proj_delete" onclick="return confirmdelete('#viewfield1#')" value="delete"></form>
</cfoutput>
</cfloop>
</body>

#note: there code here in loop query next , previous buttons, didn't post code because doesn't pertain question.

is there way make java script state in spot says, "are sure want delete record" make "are sure want delete #viewfield1#?" (the name of record being deleted) ?

thank you!

phoenix

since can submit 1 form @ time, it's simpler put js code right input tag. here 1 once wrote

<input
type="button"
value="delete"
name="deleteonerecord" onclick="if(confirm('delete record?')){this.form.whattodo.value='deleteonerecord';this.form.submit()}">



More discussions in Advanced Techniques


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support