Koin Arab
Koin Arab

Reputation: 1107

textarea in form is too small

I want to create a textareas with its parametrs "cols" and "rows" and show it in forms. Unfortunetlly this params don't work. It' no diffrence if cols=1000 and cols=1. I think it's a problem in my code. This is my table:

<table id="list">
                <thead >
                    <tr>
                        <th>Numer jednostki <br />redakcyjnej</th>
                        <th>Treść</th>
                        <th>Proponowana zmiana brzmienia zapisu <br />lub treść nowego zapisu</th>
                        <th>Uzasadnienie</th>
                    </tr>
                </thead>

                <tbody>
                    <tr>
                        <td><input type="text" size="20" name="numer[]"></td>
                        <td><input type="textarea" cols="1000" rows="800" name="tresc[]"></td>
                        <td><input type="textarea" cols="1000" rows="800" name="zmianaZapisu[]"></td>
                        <td><input type="textarea" cols="1000" rows="800" name="uzasadnienie[]"></td>
                    </tr>
                </tbody>

This is an image how it looks like. The first column is just text field but the rest columns are textareas. enter image description here

I want to resize this textareas by its parametrs. Can you help me?

EDIT:

After help the size of text areas works but i get this:

enter image description here

It's my current code:

function addRows(){
    $html = '<textarea id="template" style="display:none;" cols="100" rows="8">
                <tr id="row_{0}">

                    <td><text" size="20" name="numer[]"></td>
                    <td><textarea style="resize:both;" name="tresc[]"></textarea></td>
                    <td><textarea style="resize:both;" name="zmianaZapisu[]"></textarea></td>
                    <td><textarea style="resize:both;" name="uzasadnienie[]"></textarea></td>
                    <td><img src="/../_img/row_del.png" id="delete_{0}" alt="usun"></td>
                </tr>
            </textarea>
<table id="list">
            <thead >
                <tr>
                    <th>Numer jednostki <br />redakcyjnej</th>
                    <th>Treść</th>
                    <th>Proponowana zmiana brzmienia zapisu <br />lub treść nowego zapisu</th>
                    <th>Uzasadnienie</th>
                </tr>
            </thead>

            <tbody>
                <tr>
                    <td><input type="text" size="20" name="numer[]"></td>
                    <td><textarea style="resize:both;" name="tresc[]"></textarea></td>
                    <td><textarea style="resize:both;" name="zmianaZapisu[]"></textarea></td>
                    <td><textarea style="resize:both;" name="uzasadnienie[]"></textarea></td>
                </tr>
            </tbody>
        </table>

Upvotes: 2

Views: 3617

Answers (3)

mearti
mearti

Reputation: 46

You can not put input field inside the text area. Change your code like this

   $html = '<table id="template" style="display:none;">
                <tr id="row_{0}">
                    <td><text" size="20" name="numer[]"></td>
                    <td><textarea style="resize:both;" name="tresc[]"></textarea></td>
                    <td><textarea style="resize:both;" name="zmianaZapisu[]"></textarea></td>
                    <td><textarea style="resize:both;" name="uzasadnienie[]"></textarea></td>
                    <td><img src="/../_img/row_del.png" id="delete_{0}" alt="usun"></td>
                </tr>
            </table>

Upvotes: 2

Ronser
Ronser

Reputation: 1875

use text area tag <textarea rows="2" cols="40" name="?" id="?"></textarea>

go to the .css page

#list textarea {width:200px;  //your desired width ans height
                height:100px;
                resize: none; //to stop resizing 
               } 

Upvotes: 1

Ram Sharma
Ram Sharma

Reputation: 8819

You are using wrong way to create textarea try this

<td><input type="text" size="20" name="numer[]"></td>
<td><textarea cols="1000" rows="800" name="tresc[]"></textarea></td>
<td><textarea cols="1000" rows="800" rows="800" name="zmianaZapisu[]"></textarea></td>
<td><textarea cols="1000" rows="800" rows="800" name="uzasadnienie[]"></textarea></td>

input type never used for textarea

Upvotes: 4

Related Questions