Jeff Paetkau
Top achievements
Rank 1
Jeff Paetkau
asked on 29 Jul 2011, 10:23 PM
Hi,
I am having a problem with trailing <br> tags being removed.
Steps to reproduce in demo application
1) Go into HTML Mode
2) Enter "<br/><br/>"
3) Go to Design Mode
4) Go to HTML Mode
5) Note that the source shows only "<br/>"
I attempted the fix noted below. It does not work. The trailing <br/> has already been removed by the time it hits my breakpoint.
I am having a problem with trailing <br> tags being removed.
Steps to reproduce in demo application
1) Go into HTML Mode
2) Enter "<br/><br/>"
3) Go to Design Mode
4) Go to HTML Mode
5) Note that the source shows only "<br/>"
I attempted the fix noted below. It does not work. The trailing <br/> has already been removed by the time it hits my breakpoint.
<
script
type
=
"text/javascript"
>
Telerik.Web.UI.Editor.RemoveExtraBrakes.prototype.getHtmlContent = function (content) {
return content;
}
Telerik.Web.UI.Editor.StripJunkFilter.prototype.getHtmlContent = function (content) {
return content;
}
</
script
>
7 Answers, 1 is accepted
0
Hi Jeff,
The extra <br> tag is stripped by the ConvertToXhtml filter in Firefox. This browser adds a <br> tag when the content area is empty and since it 'tricks" the validators to believe that there is content in the editor, we added code in the ConvertToXhtml filter that strips this tag.
You can disable the ConvertToXhtml fitler if you do not want to strip the second <br/> tag:
RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertToXhtml);
Best regards,
Rumen
the Telerik team
The extra <br> tag is stripped by the ConvertToXhtml filter in Firefox. This browser adds a <br> tag when the content area is empty and since it 'tricks" the validators to believe that there is content in the editor, we added code in the ConvertToXhtml filter that strips this tag.
You can disable the ConvertToXhtml fitler if you do not want to strip the second <br/> tag:
RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertToXhtml);
Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Satish
Top achievements
Rank 1
answered on 07 Aug 2012, 12:24 PM
HI Telerik
I am new to telerik report, having problem with <br/> tag. I dont want to display <br /> in report.Please give me solution for this,
=Reports.ReportClass.HTMLSafe(Fields.FName + Fields.SName + '<br/>' +
Fields.address1 + Fields.address2 + Fields.address3 + Fields.address4 +Fields.postcode)
I am new to telerik report, having problem with <br/> tag. I dont want to display <br /> in report.Please give me solution for this,
=Reports.ReportClass.HTMLSafe(Fields.FName + Fields.SName + '<br/>' +
Fields.address1 + Fields.address2 + Fields.address3 + Fields.address4 +Fields.postcode)
0
Hello Satish,
You're probably using this expression inside the TextBox item, which does not support html. You should be using the HtmlTextBox item instead. Also this is not the correct forum for the reporting product, so if you have further inquiries, please open a new thread for the respective product.
All the best,
Steve
the Telerik team
You're probably using this expression inside the TextBox item, which does not support html. You should be using the HtmlTextBox item instead. Also this is not the correct forum for the reporting product, so if you have further inquiries, please open a new thread for the respective product.
All the best,
Steve
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tamanna
Top achievements
Rank 1
answered on 13 Aug 2012, 10:44 AM
Hi,
I am also using a radeditor. And facing a problem coz of the <br>.
When I am removing whole text from radeditor and making it blank, still it shows presence of html text as <br>, <p> </p> and sometimes <p><br></p>.
I have a required field validator for this radeditor. When I enter any text in radeditor, the error message for this required radeditor is disappearing only after a post back. But it should disappear as soon as we type any text in radeditor.
So I wrote a javascript for firing onblur event and explicitly hiding the error message if radeditor's content is not null.
I am calling the function using "OnClienLoad" :
Then in Javascript, function is like :
I also tried to compare the length of the text in radeditor and hide and unhide the required error message :
But it is not working in IE. When we type any text in radeditor ,I am able to hide the error message. But if we remove the text, we are not getting the error message back. Thus required validation is not happening.
Please help me.
Thank You in advance.
I am also using a radeditor. And facing a problem coz of the <br>.
When I am removing whole text from radeditor and making it blank, still it shows presence of html text as <br>, <p> </p> and sometimes <p><br></p>.
I have a required field validator for this radeditor. When I enter any text in radeditor, the error message for this required radeditor is disappearing only after a post back. But it should disappear as soon as we type any text in radeditor.
So I wrote a javascript for firing onblur event and explicitly hiding the error message if radeditor's content is not null.
I am calling the function using "OnClienLoad" :
<
telerik:RadEditor
ID
=
"ContractExpirationAlertEditor"
runat
=
"server"
Skin
=
"Gray"
OnClientLoad
=
"DisableRequiredMessage"
ToolsFile
=
"~/Contracting/ToolsFile.xml"
Width
=
"100%"
ContentFilters
=
"None"
OnTextChanged
=
"ContractExpirationAlertEditor_TextChanged"
>
<
CssFiles
>
<
telerik:EditorCssFile
Value
=
"~/EditorContent.css"
/>
</
CssFiles
>
</
telerik:RadEditor
>
function
DisableRequiredMessage(editor, args) {
var
element = document.all ? editor.get_document().body : editor.get_document();
$telerik.addExternalHandler(element,
"blur"
,
function
(e) {
var
editor1 = $find(
"ctl00_ContentPlaceHolder1_ContractExpirationAlertEditor"
);
var
message1 = editor1.get_html();
if
(message1 ==
'<br>'
|| message1 ==
'<p> </p>'
|| message1 ==
'<p><br></p>'
) {
document.getElementById(
'ctl00_ContentPlaceHolder1_spnEmailBody'
).style.display =
'block'
;
}
else
{
document.getElementById(
'ctl00_ContentPlaceHolder1_spnEmailBody'
).style.display =
'none'
;
}
});
}
I also tried to compare the length of the text in radeditor and hide and unhide the required error message :
var
editor2 = $find(
"ctl00_ContentPlaceHolder1_ContractPendingEContractEditor"
);
var
message2 = editor2.get_text();
if
(message2.length > 1) {
//alert("Mozozozo" + message2.length);
document.getElementById(
'<%=spnContrPendngEmail.ClientID %>'
).style.display =
'none'
;
}
if
(message2.length == 0 || message2.length == 1) {
//alert("Mozozozo");
document.getElementById(
'<%=spnContrPendngEmail.ClientID %>'
).style.display =
'block'
;
}
But it is not working in IE. When we type any text in radeditor ,I am able to hide the error message. But if we remove the text, we are not getting the error message back. Thus required validation is not happening.
Please help me.
Thank You in advance.
0
Hello,
You can attach to the keydown event or OnClientSelectionChange event and check whether the content area is empty. If it is empty show the error message.
Kind regards,
Rumen
the Telerik team
You can attach to the keydown event or OnClientSelectionChange event and check whether the content area is empty. If it is empty show the error message.
Kind regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tamanna
Top achievements
Rank 1
answered on 17 Aug 2012, 12:20 PM
Thank You for the reply.
But my problem is even for keypress event, I have to get the content of radeditor.
If the content is null, I should display the required error message back.
When I am checking length of the text in radeditor after removing all the text, its showing length as 6/13(instead of 0) in IE.
And I tried to check the html text using get_html(). It showed presence of <br> or <p> </p> or <p><br></p>.
When I am trying to compare the text with this <br> etc. (as mentioned in the codes in last post),
the loop is not getting executed at all in IE. But same is working fine in Mozilla.
Please help me.
Waiting for reply.
Regards.
But my problem is even for keypress event, I have to get the content of radeditor.
If the content is null, I should display the required error message back.
When I am checking length of the text in radeditor after removing all the text, its showing length as 6/13(instead of 0) in IE.
And I tried to check the html text using get_html(). It showed presence of <br> or <p> </p> or <p><br></p>.
When I am trying to compare the text with this <br> etc. (as mentioned in the codes in last post),
the loop is not getting executed at all in IE. But same is working fine in Mozilla.
Please help me.
Waiting for reply.
Regards.
0
Hello,
The most possible reason for why the code is not executed under IE is because the generated HTML tags are uppercase. Could you please try the following code and see if the modification will solve the issue:
Greetings,
Dobromir
the Telerik team
The most possible reason for why the code is not executed under IE is because the generated HTML tags are uppercase. Could you please try the following code and see if the modification will solve the issue:
function
DisableRequiredMessage(editor, args) {
var
element = document.all ? editor.get_document().body : editor.get_document();
$telerik.addExternalHandler(element,
"blur"
,
function
(e) {
var
editor1 = $find(
"ContractExpirationAlertEditor"
);
var
message1 = editor1.get_html().toLowerCase();
if
(message1 ==
'<br>'
|| message1 ==
'<p> </p>'
|| message1 ==
'<p><br></p>'
) {
document.getElementById(
'ctl00_ContentPlaceHolder1_spnEmailBody'
).style.display =
'block'
;
}
else
{
document.getElementById(
'ctl00_ContentPlaceHolder1_spnEmailBody'
).style.display =
'none'
;
}
});
}
Greetings,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.