使用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