Skip to main content
Question

Adding character countdown to multi-line text field

  • December 30, 2014
  • 0 replies
  • 235 views

Is there a way to add a character countdown to a multi-line text field that has a maximum character limit. Thinking something similar to when you're writing a tweet and under the field it shows how many characters you have left without refreshing the page.

Saw this: https://quickbase-community.intuit.com/questions/828916-how-do-i-add-a-word-count-function but it counts words.

This topic has been closed for replies.

  • Quickbase Alumni
  • December 31, 2014
Here's a native QuickBase version that counts the characters - but note that it will not update until you leave the focus from the multi-line text field.

Fields:

- [Text] - multi-line text field, with "Max Characters" = 500

- [Characters Remaining] - Formula Numeric field, with the following formula

500 - Length([Text])

(you can change 500 to whatever your maximum length should be - matching the setting in the field properties of [Text])

[Characters Remaining] will start with "500". Once you type something in [Text], and you leave the focus of that field (e.g. by tabbing to the next field, clicking somewhere else, etc.) - then [Characters Remaining] will update to show the number of characters remaining after subtracting from the maximum character limit.

  • Quickbase Alumni
  • January 25, 2019
Can you do this so that it updates as people are typing instead of having them click outside the field to see how many characters they have left?

  • Quickbase Alumni
  • January 25, 2019
This can be done with one Rich Text Formula field using the 3Q&S Technique:



Characters Remaining ~ Add New Record
https://haversineconsulting.quickbase.com/db/bpcddqv64?a=nwr

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=725

  • Quickbase Alumni
  • January 25, 2019
I'm a beginner app builder, so I have no clue how to do the above.  Was looking for simple solution, but I can't seem to find one.  Thank you.

  • Quickbase Alumni
  • January 25, 2019
It is simple. Just change the "6" to the fid you are trying to count the characters of and paste this code into a new Rich Text Formula Field:
"<span id=QBU_Message></span>" &
"<img src onerror='
  $('#_fid_6').on('keyup', function() {
    var message = (50 - $(this).val().length) + ' characters remaining';
    QBU_Message.innerHTML = message;
  });
'>"
On the form place this new field atop the field you are counting the characters of so it will not be obscured by the field completion menu that may popup.

  • Quickbase Alumni
  • January 25, 2019
Wow, thank you!  I was making this very complicated in my head.  I tried it and it worked.  It's the first time I use one of your solutions.  Thank you very much Dan!