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

  • SEARCH
  • Home
  • 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 3843764
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:59:04+00:00 2026-05-19T15:59:04+00:00

This SHOULD be trivially easy, but doesn’t seem to be in Rails… we need

  • 0

This SHOULD be trivially easy, but doesn’t seem to be in Rails…

we need to gather text input from the user of no more than 200 chars.

if we use text_field, and set :maxlength to 200, we seem to have only two equally UGLY choices: (a) make the field soooooo wide using :size that it won’t fit on a typical user’s screen OR (b) the user has to scroll horizontally while typing. Either approach stinks from a UI point of view.

what we WANT of course is to use text_area, and have it automatically limit the input to 200… but of course text_area has NO limit.

we certainly don’t want to wait until they SUBMIT the data to tell them “that was too long” or even worse simply truncate their data.

any cool ideas? How do we have an input box say 100 chars wide and 3 lines tall that will not let the user type more than 200 characters?

Is there some UI-enhancement framework that handles this sort of UI issue? Is adding a javascript counter in such a way that we apply it ONLY to certain input fields easy?

  • 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-19T15:59:05+00:00Added an answer on May 19, 2026 at 3:59 pm

    You can limit number of characters in textbox using javascript.

    You can, for example set a :style => "limit" or :"data-limit"=> 200 and then use css selectors in jQuery to target only those textboxes.

    Something like:

    $(".limit").maxlength({
      // options
    })
    

    Or even neater:

    var limited_textbox  = $("[data-limit]");
    limited_textbox.maxlength({
      maxCharacters: limited_textbox.data("limit"),
      // options
    })
    

    With a plugin like http://www.stjerneman.com/demo/maxlength-with-jquery
    or similar http://plugins.jquery.com/plugin-tags/character-counter

    As for UI, you could use facebook like textbox: http://www.9lessons.info/2010/03/facebook-like-expanding-textbox-with.html

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

Sidebar

Related Questions

This should be an easy problem but... I need to format a currency for
This really should be easy, but I just can't work it out myself, the
This should be simple, but the answer is eluding me. If I've got a
This should be a elementary question but why is better to use something like
This should be easy, just curious. I know httpd is the HTTP daemon, just
This should be easy (at least no one else seems to be having a
This should be a common scenario, but could not find any relevant post yet..
This should be a simple question, but I just can't recall the relevant API.
This should be painfully simple, but I cannot come up with a working connection
This should reduce the executable size quite a bit in some of my very

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.