验证程序未检查是否使用了OnClientClick [英] Validators not checked if OnClientClick used

查看:100
本文介绍了验证程序未检查是否使用了OnClientClick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我遇到一种情况,我将所需的字段验证器控件放置在需要验证的服务器控件上.对于所有这些必需的字段验证器,启用客户端脚本都是正确的.

现在,在提交"按钮上,我还需要调用JavaScript方法"setMovieName()".

我经历过,如果我将onClientClick="return setMovieName() JavaScript方法与按钮一起放置,则不会检查验证器.
如果删除JavaScript方法,则会调用验证程序.

我需要在单击按钮时完成这两项操作.请帮忙.

预先感谢!
问候,
Divya

Hi,

I have a situation where I have placed required field validator controls to the server control which needs to be validated. For all these required field validators enable client script is true.

Now at the submit button I need to call a JavaScript method ''setMovieName()'' also.

I experienced that if I place onClientClick="return setMovieName() JavaScript method with button, Validators are not checked.
If I remove the JavaScript method then the validators get called.

I need to have both the things done on button click. Please help.

Thanks in advance !
Regards,
Divya

推荐答案

setMovieName()函数的最后,您可以调用

In the last of the setMovieName() function you can call

Page_ClientValidate(grop); 



Page_ClientValidate将在客户端验证页面.



Page_ClientValidate will validate the page at client side.


嗨Prakash,

非常感谢你..这使它工作..

但是又提出了一个问题,我也正在页面上使用Ajax,直到我填写了所有必需的文本框..它会根据所需的字段验证器提供错误消息.

我需要Ajax的东西才能独立于此验证器工作..我该如何实现..任何想法都会受到赞赏.

再次感谢!
Hi Prakash,

Thanks you so much .. this made it work ..

But another issue raised , I am also using Ajax at the page which is not getting work untill I fill all the required text boxes .. it gives error messages as per the required field validators.

I need Ajax stuff to work independently from this validators .. How do i achieve this.. Any idea will be apprciated.

Thanks again !


这篇关于验证程序未检查是否使用了OnClientClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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