Solved

how to make a text box/text area expandable but not scrollable

Posted on 2008-10-03
5
909 Views
Last Modified: 2013-11-19
hi,

our clients wants a comment box that automatically expands vertically as the existing box becomes full, but they don't want scrolling.  is this possible?
0
Comment
Question by:mmingfeilam
  • 2
  • 2
5 Comments
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 250 total points
ID: 22638856
"is this possible?"

Simply, NO.  You have to specify a width and a height for a text box area, and that is fixed.  But look at RICH TEXT AREA -- it might be able to do what you want, you will have to see, the normal text area cannot do it

www.textarearich.com/
www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm
www.tcpiq.com/tcpIQ/HTMLRichTextArea/
www.topshareware.com/HTML-Rich-Text-Area-download-1456.htm
0
 

Author Comment

by:mmingfeilam
ID: 22639897
is there any that runs on the server side that allows you to save the format (somehow) to the database along with the content?
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 250 total points
ID: 22639902
I do not have one at my disposal but
1. capture input when focussing on existing textbox/hide textbox, show div
2. output keystrokes to div and save in hidden textbox
0
 

Author Comment

by:mmingfeilam
ID: 22888225
mplungjan: can you give me a simple example?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22892952
Something like this
<script>
function captureIt(cap,field) {
  if (cap) {
    field.style.display='none'
    document.getElementById('output').style.display='';
    document.onkeydown=function(e){
      e=(e)?e:event;
      if(!e)return 0;
      field.value+=String.fromCharCode(e.keyCode);
      document.getElementById('output').innerHTML=field.value
    }
  }
  else document.onkeydown=null;
}  
</script>
 
<input type="text" onFocus="captureIt(true,this)">
<span id="output" style="display:none"></span>

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 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