What is vldPersonals?

vldPersonals is a very easy to use dating/social software. It allows you to create a fully functioning & modern dating website in a matter of minutes. If You think it's too complicated - check vldPersonals!
Know more about how You can become a dating website owner

What is vldCrowd?

vldCrowd.com is the biggest unofficial community of vldPersonals owners. It is a place to share ideas and thoughts about Your dating website. It is a place to answer questions and receive answers.
Do You own a vldPersonals license? Don't hesitate and join!

Connect Today

Community members help each other to take their dating websites to the next level. Can You make your vldPersonals website better? Join and find out...

Connect With More Than 700 Dating Website Owners! Sign Up Today

How to: Characters left mod

06/07/2009 01:36 AM
5576 5 11
Today morning I decided to improve vldCrowd user experience and then share my findings.
It's so disappointing for user to find out that there is a character limit for textarea after he/she clicked submit button adding blog, comment or sending message.
Let's keep user informed about how many characters left. I googled for some nice "chars left" solution and found this one. Thank you, Anis Ahmad, for this neat piece of code.
After adapting original installation instructions I'm coming up with following step-by-step guide:
1. Open your /includes/js/misc.js and add core function into it:

// character limit
function limitChars(textid, limit, infodiv)
        var text = $('#'+textid).val();
        var textlength = text.length;
        if(textlength > limit)
                $('#' + infodiv).html('You cannot write more than '+limit+' characters!');
               return false;
                $('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
                return true;

As you can see this function expects 3 parameters: id of textarea, number of allowed characters, id of information div.
2. Open .tpl file with <textarea> you want to be tuned. Let's take blog commenting as example.
So we open 'member_blog_entry.tpl and scrolling down our page to:

<textarea class="textarea textarea_full" id="field_comment_body" cols="40" rows="5" name="body">

We need to call javascript function every key up event: onkeyup="javascript:limitChars(this.id, {settings.blog_comment_max_length}, 'charlimitinfo')"
Now that part of page should look:

<textarea class="textarea textarea_full" id="field_comment_body" onkeyup="javascript:limitChars(this.id, {settings.blog_comment_max_length}, 'charlimitinfo')" cols="40" rows="5" name="body">

3. Add information bar right below text area (<dd><textarea></textarea></dd>):

<dd id="charlimitinfo">You have {settings.blog_comment_max_length} characters left.</dd>

You probably noticed I use global template variable instead of hardcoding limit number (ex.: 500)
Thus your textarea chars lefts will work correctly even if you change limits in your site's CP.
4. Go and try! Don't forget to hit couple times F5 button for your browser to upload new misc.js
There are some variables you may find useful tuning your textareas:




  • Posted on 03/12/2011 07:06 PM
one "bug" ->
if we put this on lets say member_blog_entry.tpl
If user edit blog after writing - counter wont count those chars we had before


  • Posted on 01/05/2010 08:40 AM
What would the textarea variable be for the "about me" section in account_profile.tpl?


  • Posted on 01/04/2010 10:25 PM
Ok. I got my page to load without the internal server error - but only if i manually typed in the code. What's up with that? Now it shows "You have 500 characters left." but the number does not change when typing.


  • Posted on 01/04/2010 08:14 AM
Yeah I removed the code when it was causing the error. What login info do you need?
What do I need for the Youtube Mod if I'm using 2.5.5?


  • Posted on 01/03/2010 09:45 PM
I don't see you've installed charleft mod for blog comments. Blog entry page open just fine.
If you want me to help you give me exact situation with login details if necessary.


  • Posted on 01/03/2010 01:14 PM


  • Posted on 01/03/2010 12:10 AM
Internal server error usually hasn't anything to do with software. Apparently it's a server problem.
Can I look at your website?


  • Posted on 01/03/2010 12:06 AM
Sounds like a great little mod, but for the life of me, I can't get it to work. I followed your instructions exactly but when I go to view an existing blog or enter one myself, I get the internal server error. I am using latest version 2.5.5. Any suggestions?

Log in to leave a comment