调用的RequiredFieldValidator之后将触发JavaScript方法? [英] Call a JavaScript method after the RequiredFieldValidator fires?

查看:256
本文介绍了调用的RequiredFieldValidator之后将触发JavaScript方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能一个表单元素被视为无效之后触发JavaScript方法?这里是我的情况:

Is it possible to fire a JavaScript method after a form element is considered invalid? Here is my scenario:

有ASPX页面上2的标签。用户必须填写在两个标签信息。用户,而在选项卡单击提交按钮。然而,在需要注意标签一个必填字段。我需要创建一个自定义估价师(一个CustomValidator控件或建立从基础估价师一个新的控制)来调用JavaScript函数来显示选项卡1并显示错误所在?

There are 2 tabs on the ASPX page. The user has to fill out info on both tabs. The user, while on tab 2 clicks the submit button. However, there is a required field on tab one that needs attention. Do I need to create a custom valuator (either a CustomValidator control or create a new control from the base valuator) to call a JavaScript function to display tab 1 and show where the error is?

推荐答案

不幸的是,ASP.NET Web表单罐头字段验证控件是不是很可扩展性。我有需要的CSS类的输入字段改为在客户端验证无效状态,我从来没有发现来处理这一个很好的方式。

Unfortunately, the canned Field Validator controls in ASP.NET Webforms are not very extensible. I've had needs to change the CSS class of an input field to an invalid state upon client-side validation, and I never found a good way to handle this.

我觉得你最好的选择可能是做自己的客户端验证。我也看了这个第三方产品,它似乎是pretty全功能的,但我不能证明我的情况的费用:的 http://www.peterblum.com/DES/Home.aspx

I think your best bet might be to do your own client-side validation. I've also looked into this third party product and it seemed to be pretty fully-functional, but I couldn't justify the cost in my case: http://www.peterblum.com/DES/Home.aspx

这篇关于调用的RequiredFieldValidator之后将触发JavaScript方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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