无为清净楼资源网 Design By www.qnjia.com
经过查找网上的资料,发现好像是它本身的一个问题,原文如下:

With ASP.Net, I need to submit twice when using the RequiredFieldValidator in a FCKeditor instance
FCKeditor will not work properly with the Required Field Validator when the "EnableClientScript" property of the validator is set to "true" (default). Due to a limitation in the default validation system, you must set it to "false".

If you want to do client side validation, you must use a Custom Validator instead and provide the appropriate validation function, using the FCKeditor JavaScript API.

译文如下(翻译的不好,大家能看懂就好):
问:为什么在使用ASP.NET的RequiredFieldValidator时,我需要提交两次
答:当RequiredFieldValidator的EnableClientScript属性被设置成true时,FCKEditor不能很好的支持RequiredFieldValidator,为了解除这个限制,你必须把这个属性设置成为false 如果你希望使用客户端验证,你必须使用Custom Validator制作一个非空验证来替换RequiredFieldValidator,在其中使用FCKeditor JavaScript API即可。 

       看了这篇文章,我就去找FCKeditor JavaScript API的文档,发现它为客户端JavaScript的调用提供了一些属性和方法,于是乎,就按上述的回答写了一段JavaScript脚本来完成了验证。

详细解决方法:首先添加Javascript脚本:
复制代码 代码如下:
script language="javascript" type="text/javascript">
var oEditer;
function CustomValidate(source, arguments)
{
var value = oEditer.GetXHTML(true);
if(value=="")
{
arguments.IsValid = false;
}
else
{
arguments.IsValid = true;
}
}
function FCKeditor_OnComplete( editorInstance )
{
oEditer = editorInstance;
}
</script>

`然后添加CustomValidator,设置ClientValidationFunction="CustomValidate",注意千万别忘了ValidateEmptyText="True",否则不起作用!

这样,再试试,OK,一次就可以直接提交了,不会出现提交两次的bug了
标签:
asp.net,控件验证,FCKeditor

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。