PDA

View Full Version : HTML Editor charater limit



pradeeprajudat
14 Dec 2011, 6:10 PM
how do i achieve character limit in htmleditor
I have tried the below code,, but the problem is the cursor will be focused at the start after reaching the limit

beforesync: function (editor, htmlvalue) {
if (htmlvalue.length > 250) {
editor.pushValue();
return false;
}
}

Is there any way i can solve this problem?
Thank You

friend
15 Dec 2011, 7:01 AM
Add the following config bits to your TextArea component:


{
enforceMaxLength: true,
maxLength: 250
}

pradeeprajudat
15 Dec 2011, 1:38 PM
Below is the code for htmleditor i used

xtype: 'htmleditor',
name: 'bio',
labelAlign: 'left',
cls: 'mb-descTextCls',

id: 'xyz',
height: 191,
style: { width: '100%' },
validateOnChange: true,
listeners: {
change: function () {
},
sync: function (editor, value) {
//console.log(value);
},
push: function (editor, htmlvalue) {
// console.log('push');
},
beforesync: function (editor, htmlvalue) {
if (htmlvalue.length > 250) {
editor.pushValue();
return false;
}
}
}
can u modify to explain me how to limit the characters

Thank You

pradeeprajudat
15 Dec 2011, 1:39 PM
can u provide me an example,,,,i am trying to achieve limit on htmleditor