?
Solved

tinymce editor placeholder text and max length

Posted on 2012-08-29
3
Medium Priority
?
4,169 Views
Last Modified: 2012-09-20
I am having great difficulty trying to find a solution to get max length and placeholder text

so for example

<textarea name="myText" id="myText" maxlength="20" placeholder="my text"></textarea>

http://www.tinymce.com/
0
Comment
Question by:stargateatlantis
  • 3
3 Comments
 
LVL 10

Assisted Solution

by:stu215
stu215 earned 2000 total points
ID: 38354608
To impose a maxlength on the textarea using javascript:

<form onsubmit="return validateMe(this);">

<script>
function validateMe(frm) {
  if(frm.textareaname.value.length > 100) {
    alert("To much text in textarea");
    return false;
  }
  return true;
}
</script>

Open in new window


If you have more than one text area, copy and paste:

  if(frm.textareaname.value.length > 100) {
    alert("To much text in textarea");
    return false;
  }

Open in new window


and dont forget to replace the "textareaname" with the name of the textareas you are validating/restricting.

To change the amount of text you are restricting it by, change the value 100 to however many chars you want it to be.
0
 
LVL 10

Accepted Solution

by:
stu215 earned 2000 total points
ID: 38354672
To get to the source code using TinyMCE click on the button that says "HTML" which will allow you to edit the source code of the document you are creating.

This gives a more detailed explanation on how to get to the source editing mode:
http://www.unitedboinc.com/en/how-to-use-tinymce-wysiwyg-article-editor

See This Section in it: "If you want to edit the article html directly"
0
 
LVL 10

Expert Comment

by:stu215
ID: 38354721
To make text appear before the textarea its probably easiest for you to just put it before the textarea:

Enter your favorite food in the following box: <textarea name="myText" id="myText"></textarea>

To place default text inside the textarea:

<textarea name="myText" id="myText">I like Pizza</textarea>

As far as I know placeholder is not a valid attribute for the textarea field nor maxlength.

What are you trying to do with the placeholder text?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question