This is a migrated thread and some comments may be shown as answers.

problem using the rad editor and a asp.net validator

2 Answers 102 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 21 Mar 2009, 05:23 PM
I am having this problem as of 2 days ago. As I recall before I was not having that problem.

I am using a RadEditor and a asp.net validator to validate the radeditor. But 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 is my radeditor and validator:

<

 

telerik:RadEditor SkinID="DescriptionPanEditor" ID="txtBody"

 

 

runat="server" Height="250px" Width="99%" AllowScripts="True" EditModes="all">

 

 

<Tools>

 

 

<telerik:EditorToolGroup Tag="FileManagers">

 

 

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

 

 

<script type="text/javascript">

 

Telerik.Web.UI.Editor.CommandList[

"AddImageBut"] = function(commandName, editor, args)

 

{

DoLoadNewPhoto();

 

//for example you can apply bold formatting by firing the editor.fire("Bold");

 

};

Telerik.Web.UI.Editor.CommandList[

"AddVideoBut"] = function(commandName, editor, args)

 

{

DoLoadNewPhoto();

 

//for example you can apply bold formatting by firing the editor.fire("Bold");

 

};

</

 

script>

 

 

 

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtBody" SetFocusOnError="true"

 

 

Text="The Title field is required." ToolTip="The Title field is required." Display="Dynamic"></asp:RequiredFieldValidator>

 

 

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 24 Mar 2009, 02:02 PM
Hello Marc,

Unfortunately, I am not able to reproduce this problem. The only problem in your code that I faced is your code is the white spaces between the content tags of RadEditor:

<Content>

 

</Content>

Please, delete the white spaces <Content></Content> or entirely delete the content tags because the content misleads the validator to think that the content area is not empty.


Could you please, test the Validator Support example of RadEditor and try to reproduce the problem with the provided content? If you are unable to reproduce the problem and it only exists in your project, then please open a support ticket and send  a sample working project that demonstrates the issue. I will examine your code and provide a solution once I am able to reproduce the issue on my end.


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Marc
Top achievements
Rank 1
answered on 24 Mar 2009, 08:23 PM
thanl you for your reply. I realized that the problem is related to client side validation using asp.net clientside validaotr functions. Thats why I was not having the problem before as I was not doing the validation in javascript myself but now I am...

here is a small sample that reproduces the problem very well:

<%

@ 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>

 

 

Tags
Editor
Asked by
Marc
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Marc
Top achievements
Rank 1
Share this question
or