Hello Telrik Support,
Can we fix the max length of form elements like "Text Area", "Text Box" in radedor.
Example: suppose i have taken one text box from "INSERT FROM ELEMENTS" option.
then user must only put 10 char in text box.
Please Help !!
Thanks
Can we fix the max length of form elements like "Text Area", "Text Box" in radedor.
Example: suppose i have taken one text box from "INSERT FROM ELEMENTS" option.
then user must only put 10 char in text box.
Please Help !!
Thanks
10 Answers, 1 is accepted
0
Hello,
You can use the maxlength attribute of the input element. You can access it with JavaScript with the following code: editor.get_contentArea().getElementsByTagName('input') where editor is a reference to the RadEditor and this will return a list with all inputs there so you can modify them as needed.
Kind regards,
Rumen
the Telerik team
You can use the maxlength attribute of the input element. You can access it with JavaScript with the following code: editor.get_contentArea().getElementsByTagName('input') where editor is a reference to the RadEditor and this will return a list with all inputs there so you can modify them as needed.
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

Raaz
Top achievements
Rank 2
answered on 05 Feb 2013, 09:10 AM
Thanks for Reply,
I have implement your solution it is working fine with TextBox , But it is working with TaxtArea field.
function fixlength(editor, args) {
var a = editor.get_contentArea().getElementsByTagName('input').length;
var b = editor.get_contentArea().getElementsByTagName('input');
for (var i = 0; i < a; i++) {
if (b[i].type = "text") {
b[i].maxLength = 10;
}
}
var c = editor.get_contentArea().getElementsByTagName('textarea').length;
var d = editor.get_contentArea().getElementsByTagName('textarea');
for (var ii = 0; ii < d; ii++) {
d[ii].maxlength = 10;
}
}
The Code showing in Italic is not working properly, Please help how we can fix the Length of Text Area.
I have implement your solution it is working fine with TextBox , But it is working with TaxtArea field.
function fixlength(editor, args) {
var a = editor.get_contentArea().getElementsByTagName('input').length;
var b = editor.get_contentArea().getElementsByTagName('input');
for (var i = 0; i < a; i++) {
if (b[i].type = "text") {
b[i].maxLength = 10;
}
}
var c = editor.get_contentArea().getElementsByTagName('textarea').length;
var d = editor.get_contentArea().getElementsByTagName('textarea');
for (var ii = 0; ii < d; ii++) {
d[ii].maxlength = 10;
}
}
The Code showing in Italic is not working properly, Please help how we can fix the Length of Text Area.
0
Hello,
The maxlength attribute for textarea is supported by Firefox, Chroma and Safari. You can implement the following script to achieve your goal: Textarea Maxlength script.
Kind regards,
Rumen
the Telerik team
The maxlength attribute for textarea is supported by Firefox, Chroma and Safari. You can implement the following script to achieve your goal: Textarea Maxlength script.
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

Raaz
Top achievements
Rank 2
answered on 06 Feb 2013, 10:12 AM
But i need in IE is this possible in IE for fix max length for Textarea??
0
Hello,
Yes, using the cross-browser solution provided in this article: Textarea Maxlength script.
Kind regards,
Rumen
the Telerik team
Yes, using the cross-browser solution provided in this article: Textarea Maxlength script.
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

Raaz
Top achievements
Rank 2
answered on 06 Feb 2013, 12:39 PM
It is not working in Radeditor in IE....
function onchangee(editor, args) {
var a = editor.get_contentArea().getElementsByTagName('input').length;
var b = editor.get_contentArea().getElementsByTagName('input');
for (var i = 0; i < a; i++) {
if (b[i].type = "text") {
b[i].maxLength = 10;
}
}
var c = editor.get_contentArea().getElementsByTagName('textarea').length;
var d = editor.get_contentArea().getElementsByTagName('textarea');
for (var ii = 0; ii < c; ii++) {
//d[ii].maxlength = 10;
d[ii].onkeypress = "if(this.value.length > 10) return false;";
}
}
I have create a java script function onchangee, This function working fine for text box but not working for Text Area ,
Even OnkeyPress Event is working directly out side the Radeditor, But in RadEditor the Javascript function is not working....
<TEXTAREA onkeypress="if(this.value.length > 10) return false;"></TEXTAREA>
PLEASE HELP!!!!
Your Solution is working fine out side of the Radeditor . But this javascript is not working on Inside's Textarea of rededitor
function onchangee(editor, args) {
var a = editor.get_contentArea().getElementsByTagName('input').length;
var b = editor.get_contentArea().getElementsByTagName('input');
for (var i = 0; i < a; i++) {
if (b[i].type = "text") {
b[i].maxLength = 10;
}
}
var c = editor.get_contentArea().getElementsByTagName('textarea').length;
var d = editor.get_contentArea().getElementsByTagName('textarea');
for (var ii = 0; ii < c; ii++) {
//d[ii].maxlength = 10;
d[ii].onkeypress = "if(this.value.length > 10) return false;";
}
}
I have create a java script function onchangee, This function working fine for text box but not working for Text Area ,
Even OnkeyPress Event is working directly out side the Radeditor, But in RadEditor the Javascript function is not working....
<TEXTAREA onkeypress="if(this.value.length > 10) return false;"></TEXTAREA>
PLEASE HELP!!!!
Your Solution is working fine out side of the Radeditor . But this javascript is not working on Inside's Textarea of rededitor
0
Hi,
The content area by default is an iframe. You should ensure that your code works in a standard editable iframe and it will work in RadEditor too.
The other option is to set the ContentAreaMode to DIV and test withing an editable DIV. Again if your code does not work, test with an editable DIV:
<div contenteditable="true" style="width:300px;height:300px;border: 1px solid red;">sample content</div>
Greetings,
Rumen
the Telerik team
The content area by default is an iframe. You should ensure that your code works in a standard editable iframe and it will work in RadEditor too.
The other option is to set the ContentAreaMode to DIV and test withing an editable DIV. Again if your code does not work, test with an editable DIV:
<div contenteditable="true" style="width:300px;height:300px;border: 1px solid red;">sample content</div>
Greetings,
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

Raaz
Top achievements
Rank 2
answered on 12 Feb 2013, 10:29 AM
Thanks For Reply,
My problem is not solve with this solution ,
My requirement is that i want to create a dynamic form with TextBox and TextArea only and some Write up. The textBox should have limit only 10 character and Textarea 200 but i am not able to restrict TextArea for 200 Char, Event TextBox has been fixed for 10 character.
Note- I need this solution working on IE
Do you have any solution ??
Thanks in Advance!!
My problem is not solve with this solution ,
My requirement is that i want to create a dynamic form with TextBox and TextArea only and some Write up. The textBox should have limit only 10 character and Textarea 200 but i am not able to restrict TextArea for 200 Char, Event TextBox has been fixed for 10 character.
Note- I need this solution working on IE
Do you have any solution ??
Thanks in Advance!!
0
Hi,
Have you tried to implement the requested custom scenario with a standard editable DIV as suggested in my earlier post? All you need to do is to get the check the textareas length with the restricted length and if it exceeds to stop typing in them. This has nothing to do with RadEditor.
All the best,
Rumen
the Telerik team
Have you tried to implement the requested custom scenario with a standard editable DIV as suggested in my earlier post? All you need to do is to get the check the textareas length with the restricted length and if it exceeds to stop typing in them. This has nothing to do with RadEditor.
All the best,
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
Hello,
I tested the requested functionality in an editable iframe and I noticed that the browser does not execute the inline JavaScript code in the textarea element, which makes the implementation of this feature impossible until the browser developer do not enable it.
Best regards,
Rumen
the Telerik team
I tested the requested functionality in an editable iframe and I noticed that the browser does not execute the inline JavaScript code in the textarea element, which makes the implementation of this feature impossible until the browser developer do not enable it.
Best 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.