使用FCK编辑器控件代替textarea元素。我安装它没有问题。Fck编辑器问题
但是,当我想验证它与ASP.Net 2.0的自定义验证程序,我没有得到预期的结果。
这些线是我的代码:即执行的CustomValidator客户端功能是
<textarea style="width:30px;height:20px;" class="ckeditor" id="txtdescription" runat="server" name="txtdescription" cols="5" rows="10"></textarea>
<asp:CustomValidator id="descval" runat="server" ControlToValidate="txtdescription" EnableClientScript="true" Enabled="true" ValidateEmptyText="true" Display="Dynamic" ClientValidationFunction="ValidateTextDesc" Text="*" ErrorMessage="*"/>
<asp:Button ID="buttonadd" runat="server" Text="Add text" OnClick="buttonadd_Click" />
我的javascript代码:
function ValidateTextDesc(source, args)
{
var descriptiontext = document.getElementById("txtdescription");
if ((descriptiontext.value.indexOf("<script") != -1) || (descriptiontext.value.length==0))
{
args.IsValid=false;
}
else
{
args.IsValid = true;
}
return args.IsValid;
}
我的问题是,我必须点击两次我提交按钮来执行这个客户端功能:
你知道为什么会发生这个问题吗? 在此先感谢。 此致敬礼。 Josema。
FCK编辑器,听起来很兴奋。 – mipadi 2009-12-21 16:58:54
这就是为什么它已被更名为CKEditor的最新版本:www.ckeditor.com – 2009-12-21 16:59:32