简体   繁体   English

提交按钮上的Html确认弹出窗口

[英]Html confirmation popup on submit button

In my application i have submit button which called store procedure in my db also on same page a have textbox which required data in it. 在我的应用程序中,我有提交按钮,在我的数据库中也调用存储过程也在同一页面上有一个文本框,其中需要数据。 I used required field validator for that textbox. 我在该文本框中使用了必需的字段验证器。 And Ajax conformition thing for my submit button and confirm validation fire if text box is empty. 如果文本框为空,则我的提交按钮和Ajax符合事项并确认验证。 I need check if that textbox is filed with data firs and only after that conformation should fire on button. 我需要检查该文本框是否与数据文件一起存档,并且只有在该按钮触发后才会触发。 I don't want popup fire before required field validation. 在需要的字段验证之前,我不想要弹出窗口。

You could use something like 你可以用类似的东西

var button = document.getElementById('button'); // or whatever ID your button has
var textbox = document.getElementById('textbox'); //or whatever ID your input has
button.onclick = function() {
    if (textbox.value === "") {
        return false;
    }
    else {
        return true;
    }
}

You could use this code 你可以使用这段代码

jQuery('#<%= button.ClientID %>').click(function(){
    if(jQuery('#<%= textbox.ClientID%>').val()=='')
    {
         return false;
    }
    else
    {
        return(confirm('Are you sure?'));
    }
});

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

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