Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-09-11 10:52:53

Gythaogg
New member
Registered: 2009-08-18
Posts: 5

How to count and limit the number of characters in several textareas ?

Xinha : Release:         Trunk (Fri, 24 Apr 2009 07:50:25 +1200)
Head:            http://svn.xinha.webfactional.com/trunk/XinhaCore.js
Revision:        1188
Last Changed By: douglas

Browser : Opera 9.64


Hello,

I'm new to Xinha that seems to be a good WYSIWYG editor, while not working properly with Opera (hope it will be fixed one day).
I have read the documentation but my main problem is that Javascript is (much worse than) greek to me.

I need to use Xinha on 2 different textareas (descrtemp1 and descrtemp2) of the same page (php program).
My test program is basic :

<?
session_start();
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head><title>Calendrier-annuaire de la vie associative locale</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-15">
<style type="text/css">
BODY { background: #BBEFFF; color: navy; font-family: Optimum,Helvetica,Verdana,sans-serif; font-size: medium; width: 80%; margin: auto; text-align: center;}
</style>
<script type="text/javascript">
_editor_url  = "../xinha/" 
_editor_lang = "fr";      
</script>
<script type="text/javascript" src="../xinha/XinhaCore.js"></script>
<script type="text/javascript">
xinha_editors = null;
    xinha_init    = null;
    xinha_config  = null;
    xinha_plugins = null;
    xinha_init = xinha_init ? xinha_init : function()
    {
      xinha_plugins = xinha_plugins ? xinha_plugins :
      [
       \'CharCounter\',
       \'ContextMenu\',
       \'ListType\',
       \'SpellChecker\',
       \'Stylist\',
       \'SuperClean\',
     //  \'ExtendedFileManager\',
       \'TableOperations\'
       
      ];
             if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
      xinha_editors = xinha_editors ? xinha_editors :
      [
        \'descrtemp1\',
        \'descrtemp2\'
      ];
      xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
      xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
      Xinha.startEditors(xinha_editors);
    }
    window.onload = xinha_init;
</script>
</head>
<body>
<form action="voirtest.php" method="post" target="_blank">
<textarea id="descrtemp1" name="descrtemp1" rows="10" cols="50" style="width: 100%">'.$_SESSION['descrtemp1'].'</textarea>
<textarea id="descrtemp2" name="descrtemp2" rows="10" cols="50" style="width: 100%">'.$_SESSION['descrtemp2'].'</textarea>
<br>
   <input type="image" name="submit" src="images/visu.gif" align="middle" alt="Visualiser">
  </form>
</body></html>';
?>

Here the problem is that I need a different maximum length for the textareas : for instance, one will be limited at 500 characters, and the other one at 2500 characters. How can I do that ? And I would have prefered to limit the number of characters typed, not including the HTML tags.

Any help would be appreciated...

Offline

Board footer

Powered by FluxBB