带验证摘要消息框的Javascript [英] Javascript with Validation Summary Message box

查看:99
本文介绍了带验证摘要消息框的Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在提交按钮上设置 onClientClick =jsfunction()时,不会显示validationsummary消息框;

如果它是无效页面,如何在函数 jsfunction()中触发validationsummary消息框?

When I set a onClientClick="jsfunction()" on a submit button, the validationsummary message box would not show up;
How can I trigger validationsummary message box in the function jsfunction(), if it is invalid page?

推荐答案

嗨Sid.Mup,



替换

OnClientClick =javascript:return alertSid();



with

OnClientClick =javascript:alertSid();



return语句不允许执行下一个函数。



FYI:为你的按钮生成的html将是这样的:



Hi Sid.Mup,

replace
OnClientClick="javascript:return alertSid();"

with
OnClientClick="javascript: alertSid();"

the return statement is not allowing next function to execute.

FYI: the html generated for your button will be like this:

<input type="submit" name="btnOpenAlert" value="Alert" onclick="javascript: return alertSid(); ;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnOpenAlert&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="btnOpenAlert" />





Asp.Net添加WebForm_DoPostBackWithOptions函数,函数的return语句为不允许它执行验证摘要信息。



希望这会有所帮助。



谢谢,

Hemant



The WebForm_DoPostBackWithOptions function is added by Asp.Net and the return statement of your function is not allowing it to execute hence to validation summary message.

Hope this will help.

Thanks,
Hemant


这篇关于带验证摘要消息框的Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆