0
我想修改下面的自定義驗證程序,以便它檢查RadEditor不是空的,或者不僅包含像br和p標籤等HTML標籤,而且它必須是一些文本,而不是隻是HTML標籤。我如何實現我想要的?關於自定義驗證
<asp:CustomValidator runat="server" ID="CustomValidator1" ControlToValidate="RadEditor1" ClientValidationFunction="checkLength">* The text length should not exceed 50 symbols.</asp:CustomValidator>
<script type="text/javascript">
var limitNum = 50;
function checkLength(sender, args)
{
//Note that sender is NOT the RadEditor. sender is the <span> of the validator.
//The content is contained in the args.Value variable
var editorText = args.Value;
args.IsValid = editorText.length < limitNum;
}
事情是當我使用RadEditor所需的字段驗證器時,br標記被存儲爲值,因此驗證失敗。那麼,如何編寫一個自定義驗證器來檢查編輯器是否只有html標籤?
lemme試試這個..thnx – Serenity 2010-12-17 11:23:52