简体   繁体   English

使用div确认并提交表格

[英]Using a div to confirm AND submit a form

I have the following code: 我有以下代码:

<div class="ui-button-submit" onclick="document.forms['appointment-form'].submit();"><img src="/laravel/public/img/icon-delete.png"><span class="ui-button-text"> Mass Delete</span></div>

In my form I have a few checkboxes which I can click and then hit this button (the above code) to submit and delete those records. 在我的表单中,我有几个复选框,可以单击它们,然后单击此按钮(上面的代码)以提交和删除这些记录。 The thing is, I need to have a confirmation message in the above code, so it asks for a confirmation before submitting the form. 事情是,我需要在上面的代码中有一条确认消息,因此它在提交表单之前要求确认。 Any ideas? 有任何想法吗?

You need to show confirm box before submitting the form. 您需要在提交表单之前显示确认框。 So , first change the form submit method call, when you click on Mass Delete button show Confirm dialogue using JavaScript , then user click on OK or YES button then submit the form(call your method document.forms['appointment-form'].submit()). 因此,首先更改表单提交方法调用, 当您单击“批量删除”按钮显示使用JavaScript的“确认对话框”时 ,然后用户单击“确定”或“是”按钮,然后提交表单(调用方法document.forms ['appointment-form']。提交())。

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

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