-
1. Re: How to restrict the rich:editor content to 4000 characters
mcmurdosound Feb 7, 2012 1:54 AM (in response to vi_mahe_ka1)for jsf 1.2 and rf 3.3.3 I successfully used for this the standard buildin jsf validators. I think it was <f:validateLength maximum="4000" /> as a child of the rich:editor.
-
2. Re: How to restrict the rich:editor content to 4000 characters
vi_mahe_ka1 Feb 8, 2012 1:06 AM (in response to mcmurdosound)any other alternative option to restrict, like maxlength which will restrict the user to maximum length instead of validating the input.
all suggestions are welcome.
-
3. Re: How to restrict the rich:editor content to 4000 characters
mcmurdosound Feb 8, 2012 2:04 AM (in response to vi_mahe_ka1)ok, since the rich:editor in rf3 is a tinymce, you could go on from there:
http://pogostick.co.nz/limiting-character-count-with-tinymce/
maybe there is some plugin to prevent userinput beyond a maximum count of characters (including htmltags)
-
4. Re: How to restrict the rich:editor content to 4000 characters
vi_mahe_ka1 Feb 8, 2012 6:39 AM (in response to mcmurdosound)1 of 1 people found this helpfulWonderfull solution. it works fine for me.
Christian you are the best.i have seen many posts of you. but this one really impressed me. Thank you very much.
here is what i did for those who refering the solution
use following code
<rich:editor onsetup="setup(this);" />
function setup(ed){
ed.onKeyUp.add(
function (ed, evt) {
document.getElementById('deslen').value = tinyMCE.activeEditor.getContent().length;
if(tinyMCE.activeEditor.getContent().length > 4000){
tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent().substring(0,4000));
}
}
);
};it shows the number of characters entered in the editor. as well it sets first 4000 characters to the editor.