This topic is locked

Characters remaining

3/24/2009 8:17:51 AM
PHPRunner General questions
T
thesofa author

Hi

When I have a text area for a field, maybe a text or tinytext variable type, I would like to be able to show how many characters are left for input.

There has been one post about this over 2 years ago, but since then we have a different backend to the PHPR projects as we nw have XT instead of smarty.

Has anyone done this with some of the javascript apps around on the net?

Sergey Kornilov admin 3/24/2009

It works the same way in all versions of PHPRunner.
Pick any example of this on the web say this one: http://www.hscripts.com/scripts/JavaScript...acter-count.php

Add a new readonly field in Visual Editor to display the number of characters left.
Redefine textarea's onkeyup event handler to use supplied Javascript function that updates the counter.

<script>

document.editform.textareafield_value.onkeyup=function() { ... };

</script>


This should be it.

T
thesofa author 3/25/2009

It works the same way in all versions of PHPRunner.

Pick any example of this on the web say this one: http://www.hscripts.com/scripts/JavaScript...acter-count.php

Add a new readonly field in Visual Editor to display the number of characters left.
Redefine textarea's onkeyup event handler to use supplied Javascript function that updates the counter.

<script>

document.editform.textareafield_value.onkeyup=function() { ... };

</script>


This should be it.



As usual, I only gave you half of the info, I should have pointed out that I want do do this in a text area in Inline Edit, where there may be several of these boxes open in different records, so how do I do it, has anyone got a working sample for me to blag please?

A
acpan 3/30/2009

Hi, try this link, here, another approach see if it helps.

Sergey Kornilov admin 3/30/2009

acpan,
thank you for sharing!
I moved that post to 'Tips and tricks' section so others can find it easily.