troubleshooting Question

limit textarea issue tinyMCE

Avatar of ellandrd
ellandrdFlag for Ireland asked on
Web Languages and StandardsJavaScript
18 Comments4 Solutions3723 ViewsLast Modified:
im using tinyMCE editor and i want to limit the user to 50 charactors.

if they enter more than this limit, prompt them and ask if they want to enter more.  if yes, show an additional textarea.  

if i enter more than 50 charactors, i get prompted so im happy that my max character check is working.  

however if i try to edit the textarea (e.g. click on the textarea etc etc), i keep getting prompted that im over the max limit and therefore i cannot edit the textarea.

im keeping track of the number of charactors entered into the textarea using this event handler:

handle_event_callback : "CheckSize"

function CheckSize()
{
      var x = tinyMCE.getContent();

      if(x.length > 50)
      {
            if(confirm('You have reached the maximum size for this field.  Do you require to enter more?'))
            {
                  //show extra textarea
            }
            else
            {
            //hide extra textarea
            }
      }
return true;
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 4 Answers and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros