Re: Max word count?

  •  12-06-2010, 9:51 PM

    Re: Max word count?

    Well, I hope the company considers developing this as a property that can be validated and enforced. In the meantime, I have developed an approach using a javascript onsubmit function:
     

    function getLen(){
    // get the cute editor instance
    var editor1 = document.getElementById('<%=editor.clientID%>');

    // retrieving the content of Cute Editor as HTML
    var content = editor1.getHTML();
    //split the content by spaces to get the array of words
    arWords=content.split(" ");
    //use the length property of the array to count words.
    //Probably should trim any leading or trailing spaces.
    strWordLength="Words: " + arWords.length;
    //this just prints out the length, but you could use it to fail the onsubmit
    alert(strWordLength);
    }
     
    %<
    snips

    There is only do or not do - there is no try.

    Yoda
View Complete Thread