Solved

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

Posted on 2004-08-24
8
380 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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 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…

758 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

22 Experts available now in Live!

Get 1:1 Help Now