简体   繁体   English

如何在Coldfusion 8中生成确认弹出窗口

[英]How to generate a confirmation popup in Coldfusion 8

I'm working on a CFC in Coldfusion 8 and I need to setup a confirmation popup before a person deletes a record. 我正在Coldfusion 8中使用CFC,并且需要设置一个确认弹出窗口,然后一个人才能删除记录。 Here is my base piece of code I'm working with: 这是我正在使用的基本代码:

<!---Initiated when user clicks "Delete Association"--->
<!---User should be prompted by a popup to confirm intent to delete--->
<!--if user confirms delete, click event in popup triggers function below--->
<cffunction name="DeleteEmployeeAssignment" access="remote" 
       description="deletes selected employee from selected report assignment" 
       returntype="void">
    <cfquery name="qryDeleteEmployeeAssignment" datasource="Corp_Dev" dbname="Corp_Dev_DB">
        DELETE FROM [Corp_Services_Dev].[dbo].[AssignedReports]
        WHERE employeeID ='11283' AND assignedReport = '1'
    </cfquery>
    <!---User is given a success message on deletion--->
</cffunction>

Because this is before CF9 I can't use the CFwindow tag. 因为这是在CF9之前,所以我不能使用CFwindow标记。 Any suggestions would be greatly appreciated. 任何建议将不胜感激。

You could simply try return confirm('Are you sure you want to delete this?') as an onClick event on whatever is calling the method. 您可以尝试在调用该方法的任何事件上将return confirm('Are you sure you want to delete this?')作为onClick事件。 You showed us the method that you are calling, but this would be on whatever is calling the method. 您向我们展示了您正在调用的方法,但这将在调用该方法的任何地方。 So, if "Delete Association" is a button or a link, you should be able to use the onClick event there. 因此,如果“删除关联”是按钮或链接,则应该可以在其中使用onClick事件。 Not fancy, but it should get the job done. 不花哨,但应该可以完成工作。 Many other ways to skin that cat using the JavaScript library of your choice. 您可以使用多种其他方法使用您选择的JavaScript库为那只猫换皮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM