在ASP.NET C#中发出甜蜜警报之前验证表单

问题描述

当我单击提交按钮甜蜜警报打开时,我正在通过提交表单上的JavaScript使用显示甜蜜警报,当我单击确定时,它将在POST上验证表单... 我想在甜蜜提醒显示之前进行验证。.

function createtransaction(btnsubmit) {

if (btnsubmit.dataset.confirmed) {
    // The action was already confirmed by the user,proceed with server event
    btnsubmit.dataset.confirmed = true;
    return true;
} else {
    event.preventDefault();
    swal({
        title: "Are you sure?",text: "Once you create Escrow Transaction,Invitation will be sent to the other party!",icon: "warning",buttons: true,dangerMode: true,})
    .then((willDelete) => {
        if (willDelete) {

            swal("Escrow Transaction invitation has been sent successfully!",{
                icon: "success",}).then(function () {
                // Set data-confirmed attribute to indicate that the action was confirmed
                btnsubmit.dataset.confirmed = true;
                // Trigger button click programmatically
                btnsubmit.click();

            })
        }
        else {
            swal("Escrow Transaction invitation has been cancelled",{
                icon: "error",});
        }
    });
}}

并且按钮代码

 <asp:Button ID="btnsubmit" runat="server" class="btn btn-primary" Style="float: right" Text="Submit" OnClick="btnsubmit_Click" OnClientClick="return createtransaction(this);" />

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)