I have a RedEditor with the ID radEditor1 and the following javascript function:
I call this function from the following link in a formview:
When the javascript is hit, $find(editorId) returns null.
How would I get the text in this instance? I have tried all the examples I can find, but all return null or give some other error.
Help is appreciated!
// Character and Word Counter for Telerik RadEditor
// Parameters:
// ID of the RadEditor
// Maximum number of words allowed
// Returns false if maxWords is exceeded, true otherwise
function LimitWordCount(editorId, maxWords)
{
var content = $find(editorId).get_text();
var words = 0;
var chars = 0;
LimitWordCount = true;
if (content) {
punctRegX = /[!\.?;,:&_\-\-\{\}\[\]\(\)~#'"]/g;
content = content.replace(punctRegX, "");
if (content) {
splitRegX = /\s+/;
var array = content.split(splitRegX);
words = array.length;
chars = content.length;
}
}
if (words > maxWords) {
alert("Cannot exceed maximum word count. Please shorten text.\nTo undo a paste, click the undo button at the top of the text area.")
LimitWordCount = false;
}
}
I call this function from the following link in a formview:
<
asp:LinkButton
ID
=
"UpdateButton"
runat
=
"server"
CausesValidation
=
"True"
CommandName
=
"Update"
Text
=
"Save"
CssClass
=
"linkbutton"
OnClientClick
=
'LimitWordCount("RadEditor1", 30)'
/>
When the javascript is hit, $find(editorId) returns null.
How would I get the text in this instance? I have tried all the examples I can find, but all return null or give some other error.
Help is appreciated!