Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 336335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:13:58+00:00 2026-05-12T10:13:58+00:00

How do you get the length of the text inside a Mojo TextField? I’m

  • 0

How do you get the length of the text inside a Mojo TextField?

I’m trying to set a multiLine TextField with a limit of 150 chars, I tried doing it with a counter, but ran into a issue of not being able to decrement the counter when the text was erased, or adding the right number when pasting text, so my new approach was to get the length of the text each time you press a letter.

I’ve already tried this: (gets called in the charsAllow attribute of the textField)

if (this.controller.get("mensaje").mojo.getValue().length <= 150) {
    return true;
}

this.controller.get("mensaje").mojo.blur();
return false;

but it doesn’t work…. I debugged and the function exits just after the line in bold… it doesn’t even returns true or false.

I also tried assigning the length value to a variable or assigning the text to a variable and then get the length, but nothing.

It’s the same issue. It returns just after the getValue().

Also, maybe because of this issue, the text scrolls instead of wrapping, but when the textField loses focus it wraps the text.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:13:58+00:00Added an answer on May 12, 2026 at 10:13 am

    My first guess would be that “this” isn’t being passed into charsAllow properly. Did you .bind(this) the function you’re passing as an argument?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the caret position for some text inside an iframe
How can I get the length of text entered in a textbox using jQuery?
I always get back Content Length Required 411, what am I doing wrong here?
How do I get Set Selection to work in a text field. I have
I want to get the caret position inside text area (Internet Explorer only). I
Is it possible to set multiple styles for different pieces of text inside a
Hi I am trying to work on a script to get back XML text
Is it possible to get width of text inside a textarea element? I don't
I'm trying to use a Toast message inside a listener method, but I get
How do you get the length of a string in jQuery?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.