Solved

text area delimitation

Posted on 2003-11-17
6
242 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 125 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 125 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

751 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