This is a problem using the javascript functions of the asp.net validators on the client with the rad editor.
I did not have problems when I was using the validators on a page but when i want to do validation on the client using the client side javascript function of the asp.net validators I get this error:
the validator always is triggered and fails the validation even thought there is some text in the editor. But if I put an <img></img> tag then it passes the validation:
for example this does not validate:
iuyuy<br />
qqwwq<br />
<br />
<span style="color: #ff0000">qwwqe</span><br />
but this does validate:
iuyuy<br />
qqwwq<br />
<br />
<span style="color: #ff0000">qwwqe</span><br /><img></img>
this small example reproduces the problem:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default43.aspx.vb" Inherits="Default43" %>
<%
@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<title></title>
</
head>
<
body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TextBox1" ID="RequiredFieldValidator2" runat="server"
ErrorMessage="RequiredFieldValidator" Display="Dynamic"></asp:RequiredFieldValidator>
<telerik:RadEditor ID="RadEditor1" Runat="server">
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="AddImageBut" ShowIcon="true" />
<telerik:EditorTool Name="AddVideoBut" ShowIcon="true" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="Bold" />
<telerik:EditorTool Name="JustifyCenter" />
<telerik:EditorTool Name="Italic" />
<telerik:EditorTool Name="Underline" />
<telerik:EditorSeparator />
<telerik:EditorTool Name="ForeColor" />
<telerik:EditorTool Name="BackColor" />
<telerik:EditorSeparator />
</telerik:EditorToolGroup>
</Tools>
<Content></Content>
</telerik:RadEditor>
</div>
<asp:Button OnClientClick="ValidateMe();return false;" ID="Button1" runat="server" Text="Button" />
<asp:RequiredFieldValidator ControlToValidate="RadEditor1" ID="RequiredFieldValidator1" runat="server"
ErrorMessage="RequiredFieldValidator" Display="Dynamic"></asp:RequiredFieldValidator>
</form>
</
body>
</
html>
<
script type="text/javascript" language="javascript">
var val = '<%= RequiredFieldValidator1.ClientID %>';
var val2 = '<%= RequiredFieldValidator2.ClientID %>';
var edi = '<%= RadEditor1.ClientID %>';
function ValidateMe() {
ValidatorValidate($get(val));
ValidatorValidate($get(val2));
if ($get(val).isvalid && $get(val2).isvalid) {
alert(
'valid');
}
else {
alert(
'not valid');
}
}
</
script>