- Forums - Reply - Statistics - Sign Up - Search -

The Wyzz WYSIWYG Editor / Coding Discussion / Posting length is different then the typed text
Author Message
Holian
Member
# Posted: 17 Feb 2010 10:00


Hello!

I have this little code:

<div class="center"><textarea name="text" id="text" rows="10" cols="40"></textarea>
<script language="JavaScript" type="text/javascript" src="js/wyzz.js"></script>
<script language="javascript1.2">make_wyzz('text');</scrip t></div>

I type for example: fg

Then i post the data, and echo the $_POST['text']; then echo strlen($_POST['text']); I get 6 for strln.
Whats the problem? Why post extra chars?

Thank you.

Holian
Member
# Posted: 17 Feb 2010 11:28


ok - ok--im a fool...
This post all the formatting character too: like <p> and thats way this is longest...

But so... how can i check the typed character ?

RGaba
Member
# Posted: 19 Feb 2010 19:43


I can't try this now, but take a look at the following url and try playing around with the innerHTML in the line that reads:
document.getElementById("wysiwyg" + n).contentWindow.document.body.innerHTML.length;

Try changing innerHTML to outerHTML, innerText, outerText, etc..

www_wyzz_info/forum/index.php?action=vthread&forum =3&topic=126&page=0#2

pbrenna
Member
# Posted: 20 Feb 2010 10:36


If you want to get the content length without tags in php, you should try this:
echo(strlen(strip_tags($_POST['text'])));
the function strip_tags strips all html tags, you can see how it works in the php manual.

RGaba
Member
# Posted: 21 Feb 2010 16:20


Doh! I'm a big dumb animal... I didn't finish reading the question to see they were trying to do it in PHP! -My bad....

Your answer

Bold Style  Italic Style  Underlined Style  Image Link  URL Link  Disable BB codes *What's that?

 » Name  » Password 
 Only registered users can post here. Enter your login/password correctly before posting a message, or register first.
 

Powered by miniBB forum software © 2001-2010