Solved

Dynamically changing textarea cols and rows - working in Mozilla but not IE - Why?

Posted on 2004-08-24
8
387 Views
Last Modified: 2008-03-17
I have a app where I can expand/collapse a sidebar (of portal like blocks) to allow more area in the center for the main application. When I collapse the left side, I'd like to change the textarea size of the form since there is now more room.

In my toggleleftblocks function I have this which works in Mozilla (XP) but not in IE 6. No Error just don't get any change in IE

                        document.frm_edit.content.cols=100;

Is there a better way to do this?

0
Comment
Question by:Bl248
  • 3
  • 3
  • 2
8 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 125 total points
ID: 11880903
this works for me in IE6:

<HTML>
<HEAD>
<SCRIPT language='javascript'>

 function onLoadHandler()
 {
   alert("before: " + document.myform.myTextArea.cols);
   document.myform.myTextArea.cols=11;
   alert("after: " + document.myform.myTextArea.cols);
 }

</script>
</head>

<BODY onload="onLoadHandler();">

<FORM name='myform' onSubmit='return false;'>

  <TEXTAREA name="myTextArea"></textarea>

</form>

</body>
</html>
0
 
LVL 4

Expert Comment

by:MrClean21
ID: 11880906
Hi,

You can use the style or even a CSS like :

document.getElementById("frm_edit").style.width="200px";

or

document.getElementById("frm_edit").className="wideArea";

Hope this help
MrClean
0
 
LVL 4

Expert Comment

by:MrClean21
ID: 11880921
Sorry, mistake on the field name should read

document.getElementById("content").style.width="200px";

or

document.getElementById("content").className="wideArea";

MrClean
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 33

Expert Comment

by:knightEknight
ID: 11880923
... previous code also works with specifed rows/cols:

  <TEXTAREA name="myTextArea" rows=10 cols=16></textarea>
0
 

Author Comment

by:Bl248
ID: 11881218
Hum .. something is odd then with my IE browser.

This works as well in Mozilla/Firefox on my XP desktop but does nothing in IE.
I removed the cols and rows settings in the textarea form field and Mozilla sets the textarea based on the CSS but IE just shows a default litte textarea.

#content {
    background-color: #ff6790;
      vertical-align:top;
      width:600px;
      height:400px;
}
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 11881254
did you close your </form> tag around the text area?
could be any number of little things like that ...
0
 

Author Comment

by:Bl248
ID: 11881257
Wait .. I know what it is ....    Doh!!

I have the HTMLArea Editor loading on IE for that teaxtarea field -- does not show on Mozilla.

I really would like the Editor to be used since my target users are all business desktops and specifying IE is not an issue.

I think I'll need to post this as a new question then unless you fine folks know if it is possible to resize this field if the HTMLArea Editor is being used.
0
 

Author Comment

by:Bl248
ID: 11882450
Thanks guys for your quick replies .. you confirmed that I was had the right idea. It was HTMLArea that was the issue with IE and by setting it's setting for width to 100% it will scale but the height will not change. Thats ok for my application.

I was reading on their site that ohers have asked for a way to refresh the component and that its an iframe I believe but there was no posted solution.  For me -- I'm ok with just the width adjusting as it does if I use config.width=100% in the setup.

I guess in this case - points go to knight as he replied first to confirm that it should work but I appreciate MrClean jumping in quickly as well.
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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
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 …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

856 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