Solved

text area delimitation

Posted on 2003-11-17
6
237 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
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
ThG earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now