1

I've digged a lot but still didn't found answer for my case. I have some model window, inside of it I have some textarea:

<div class="form-group">
    <label for="groupDescription" class="col-sm-2 control-label">
            Description: </label>
    <div class="col-sm-10">
        <form:textarea path="groupDescription" cssClass="form-control" />
        <form:errors path="groupDescription" />
    </div>
</div>

It automatically have the same width as input forms in this window, this is good. But! I can resize it, so it can be outside of modal window borders. How can I disable this width resizing? For length I would like to set some option like "length is 2 rows, but no more than 10 rows". Can you help? Also, can I do it without JavaScript? Thanks in advance! :)

P.S. Sorry, I've needed to edit title.

Alex
  • 35
  • 7
  • possible duplicate of [How to disable resizable property of textarea?](http://stackoverflow.com/questions/5235142/how-to-disable-resizable-property-of-textarea) – sp00m Jan 23 '15 at 13:10
  • Close, but not exactly! I've read this one, thanks! – Alex Jan 23 '15 at 13:22

2 Answers2

0

To prevent the textarea from resizing you can simply add the CSS attribute to your textarea class resize: none; .

Apart from this <form:textarea> has no difference with the html textarea , it rendered as normal textarea in the browser. you can check that by inspecting it the browser source.

You can use resize: vertical; to allow only resizing its length

Santhosh
  • 8,181
  • 4
  • 29
  • 56
  • Yes, you right! But! I want to disallow only width resizing, not length too... For length it would be better to set some option like "length is 2 rows, but no more than 10 rows". Can you help with this? – Alex Jan 23 '15 at 13:18
  • Updated my answer have a look at – Santhosh Jan 23 '15 at 13:34
  • Good! And how about "length is 2 rows, but no more than 10 rows", do you know how to do it? – Alex Jan 23 '15 at 13:39
0

You can use resize: vertical;, this will allow vertical resize only.

Paulo Segundo
  • 448
  • 3
  • 6