thanks for the link,I had seen this before but for some reasons it doesn't work for me!
I have this function which shows the remaining characters in here 10 to 0 . at this point my problem is when it reachs to 0 it contines with -1,-2,...
can you help me to stop it when it reachs to 0 ??
function OnClientLoad(editor) {
editor.attachEventHandler("onkeydown", function (e) {
var content = editor.get_text();
var maxLenght = 10;
var counter = 0;
var message = 'You are not able to type more than ' + maxLenght + ' characters!';
if (content) {
var punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
var contentcontent = content.replace(punctRegX, "");
var trimRegX = /(^\s+)|(\s+$)/g;
contentcontent = content.replace(trimRegX, "");
}
var counter = $get("counter");
counter.innerHTML = "Characters left: " + (maxLenght - content.length);
});
}
thanks for the link,I had seen this before but for some reasons it doesn't work for me!
I have this function which shows the remaining characters in here 10 to 0 . at this point my problem is when it reachs to 0 it contines with -1,-2,...
can you help me to stop it when it reachs to 0 ??
function OnClientLoad(editor) {
editor.attachEventHandler("onkeydown", function (e) {
var content = editor.get_text();
var maxLenght = 10;
var counter = 0;
var message = 'You are not able to type more than ' + maxLenght + ' characters!';
if (content) {
var punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
var contentcontent = content.replace(punctRegX, "");
var trimRegX = /(^\s+)|(\s+$)/g;
contentcontent = content.replace(trimRegX, "");
}
var counter = $get("counter");
counter.innerHTML = "Characters left: " + (maxLenght - content.length);
});
}
var rtfEditor = $find("<%=RadEditor.ClientID %>");
Server Error in '/Forum' Application.
--------------------------------------------------------------------------------
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
If you are use RadAjaxManager or RadAjaxPanels, then you need to surround your "raw" code blocks with RadCodeBlocks:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script language="javascript" type="text/javascript">
//Your code here that contains <% %> blocks
//(You can safely wrap code with or without <% %>)
</script>
</telerik:RadCodeBlock>
This should solve your problems and allow you to reset runat="server" in your head tag. Details:
Member
2 Points
89 Posts
Javascript Characters Counter/Remaining
Jul 18, 2010 09:02 AM|Userr_|LINK
Hello,
I want to show the remaing characters in RadEditor.
I have set the limitation for the radEditor but don't know how I can get the remaining Characters.
I know how to do it for textBox but telerik:radEditor does not supprt the onKeyUp and Down.
I could not find any samples on net!Can anyone help me please.
Thanks
javascipt telerik radEditor
Contributor
2801 Points
708 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 09:56 AM|itsmemuthu|LINK
try with this...
Remember To Click On the Post That Helps U
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 10:21 AM|Userr_|LINK
Hi,
As I said I want the solution for radEditor
Br.
Contributor
2801 Points
708 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 10:29 AM|itsmemuthu|LINK
check with this..
http://www.telerik.com/community/forums/aspnet-ajax/chart/charector-limit-in-rad-editor.aspx
Remember To Click On the Post That Helps U
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 12:07 PM|Userr_|LINK
thanks for the link,I had seen this before but for some reasons it doesn't work for me!
I have this function which shows the remaining characters in here 10 to 0 . at this point my problem is when it reachs to 0 it contines with -1,-2,...
can you help me to stop it when it reachs to 0 ??
Thanks
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 12:07 PM|Userr_|LINK
thanks for the link,I had seen this before but for some reasons it doesn't work for me!
I have this function which shows the remaining characters in here 10 to 0 . at this point my problem is when it reachs to 0 it contines with -1,-2,...
can you help me to stop it when it reachs to 0 ??
Thanks
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 18, 2010 01:30 PM|Userr_|LINK
I have another question.
how to send an alert when it is the max characters
in this point is 10 which means when the remaing characters are 0 it should send the alert.
Thanks again
Contributor
2801 Points
708 Posts
Re: Javascript Characters Counter/Remaining
Jul 19, 2010 12:39 AM|itsmemuthu|LINK
did u make a try with this script from the above said link..it has both counter and alert..
Remember To Click On the Post That Helps U
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 19, 2010 02:48 AM|Userr_|LINK
I ger error on this line
var rtfEditor = $find("<%=RadEditor.ClientID %>");
Server Error in '/Forum' Application.
--------------------------------------------------------------------------------
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Contributor
2801 Points
708 Posts
Re: Javascript Characters Counter/Remaining
Jul 19, 2010 03:23 AM|itsmemuthu|LINK
Try removing the runat=server from the <head> tag in your document.
Remember To Click On the Post That Helps U
Member
2 Points
89 Posts
Re: Javascript Characters Counter/Remaining
Jul 19, 2010 03:47 AM|Userr_|LINK
it works fine now!Thanks
but is there any way I can keep the runat=server ??? won't it create bug for other features of the application!?
Participant
1170 Points
311 Posts
Re: Javascript Characters Counter/Remaining
Jul 20, 2010 03:37 PM|tanglin05|LINK
If you are use RadAjaxManager or RadAjaxPanels, then you need to surround your "raw" code blocks with RadCodeBlocks:
This should solve your problems and allow you to reset runat="server" in your head tag. Details:
http://www.telerik.com/help/aspnet-ajax/ajxradscriptblockradcodeblock.html
telerik
http://telerikwatch.com