Nanospell Spell Checking Software Components
JavaScript jQuery CKEditor TinyMCE PHP ASP.Net Classic ASP

PHP SpellChecker

Setting a Maximum Length for a Spell-Check-As-You-Type Textarea

PHP SpellCheck allows you to set a maximum number of characters for a Textarea with SpellAsYouType applied. This closely matches the HTML5 Text-area 'maxlength' attribute

Set a Maximum Size

<textarea name="spellfield" id="spellfield" cols="50" rows="20" maxlength='250'  >
Max length is 250
</textarea>


<?php
        require  "phpspellcheck/include.php" // Full file path to the include.php file
        $mySpell = new SpellAsYouType();
        $mySpell->InstallationPath =  "/phpspellcheck/";
        $mySpell->Fields = "spellfield";
        echo $mySpell->Activate();
?>

Character Count

The following code not only sets a maximum length, but also does a character count.

<textarea name="spellfield" id="spellfield" cols="50" rows="20" maxlength='250'  >
Max length is 250
</textarea>

<div id="counter1"></div>

<script type='text/javascript'>

countChars = function(field,output){
        var oField = document.getElementById(field);
        var oOut = document.getElementById(output);
        if(!oField || !oOut){return false};
        var maxChars =  oField.maxLengh;
        if(!maxChars){maxChars =  oField.getAttribute('maxlength') ; };
                 
        if(!maxChars){return false};
                
                
        var remainingChars =   maxChars - oField.value.length
        oOut.innerHTML = remainingChars+" Characters Remaining"
}

setInterval(function(){countChars('spellfield','counter1')},50);

</script>


<?php
        require  "phpspellcheck/include.php" // Full file path to the include.php file
        $mySpell = new SpellAsYouType();
        $mySpell->InstallationPath =  "/phpspellcheck/";
        $mySpell->Fields = "spellfield";
        echo $mySpell->Activate();
?>