Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

text area delimitation

Posted on 2003-11-17
6
Medium Priority
?
244 Views
Last Modified: 2010-04-06
HI

Is there any way to make a text area and not to show (or permit to write) the scroll bar,

<textarea style="overflow:hidden" rows="3" name="S1" cols="20" ></textarea>

it hides the scroll bar but don´t limit the entry only to 3 rows, and that's what i want

0
Comment
Question by:Alejandro_Lopez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
ThG earned 500 total points
ID: 9768194
You have to use javascript to do that..
Here is the function i used to limit the total lenght of the inserted message:
You can change the stri.length check with a rows check.. probably counting the number of '\n' in the message. Quite trivial if you check char by char.

function maxLength(tbox)
{
  var stri = tbox.value;
  if (stri.length > 255) {
    alert('Please don\'t type more than 255 characters');
    tbox.value = stri.substring(0,255);
    return false;
  }
  else
    return true;
}
0
 
LVL 5

Assisted Solution

by:DesertWarrior
DesertWarrior earned 500 total points
ID: 9768202
textarea do NOT have a maxlength property
however, here is a function that can help you limit the user to enter a certain amount of characters
taken from : http://www.teratech.com/ColdCuts/cutdetail.cfm?cutid=310

<FORM NAME="NotesForm">
 <TEXTAREA
  NAME="OrderNotes"
  TABINDEX="1"
  ROWS="8"
  COLS="32"
  ONBLUR="textCounter(this,this.form.counter,256);"
  ONKEYUP="textCounter(this,this.form.counter,256);"></TEXTAREA><BR>
 <INPUT
  TYPE="text"
  NAME="counter"
  TABINDEX="999"
  MAXLENGTH="3"
  SIZE="3"
  VALUE="256"
  ONFOCUS="this.blur();"
  ONBLUR="textCounter(this.form.OrderNotes,this,256);"> characters remaining
</FORM>
 
function textCounter( field, countfield, maxlimit ) {
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  field.blur();
  field.focus();
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;
 }
}
0
 
LVL 5

Expert Comment

by:DesertWarrior
ID: 9768234
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question