Jump to content

Problem With Textarea


visitor

Recommended Posts

Hi

 

Data is entered directly into the database (phpMyAdmin). When this data then is then looked up on the website, it shows only a part of the first line as the table is too small. The textarea must be dynamic as texts vary in size.

 

Does anyone have a good idea how this problem can be solved best?

 

Dok2.doc

<tr>
   <td input type="textarea" class="fieldset"><div class="tbl_lbl">FUND STRATEGY</div>
    <div class="tbl_input">
	 <input size="57" name="fund_strategy" id="fund_strategy"
	  value="<?php echo $arrayFund[0]['fund_strategy']?></textarea>
    </div></td>
  </tr>

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/272308-problem-with-textarea/
Share on other sites

<tr>
<td input type="textarea" class="fieldset"><div class="tbl_lbl">FUND STRATEGY</div>
<div class="tbl_input">
<input size="57" name="fund_strategy" id="fund_strategy"
value="<?php echo $arrayFund[0]['fund_strategy']?></textarea>
</div></td>
</tr>

 

That looks confusing as hell? Shouldn't it be more like this?

 

<tr>
<td class="fieldset">
<div class="tbl_lbl">FUND STRATEGY</div>
<div class="tbl_input">
<textarea size="57" name="fund_strategy" id="fund_strategy">
<?php echo $arrayFund[0]['fund_strategy']?>
</textarea>
</div>
</td>
</tr>

So, I finally thought I have found some code to expand the textarea dynamically. But no... anyway, here's the javascript code to this textarea. If someone has got a code that works, please let me know. Thanks

 

<tr>

<td class="fieldset">

<div class="tbl_lbl">FUND STRATEGY</div>

<div class="tbl_input">

<textarea id="fund_strategy" onkeyup="new do_resize(this);" cols="43" rows="1" name="fund_strategy">

<?php echo $arrayFund[0]['fund_strategy']?></textarea>

</textarea>

</div>

</td>

</tr>

 

function do_resize(textbox) {
var maxrows=5;
var txt=textbox.value;
var cols=textbox.cols;
var arraytxt=textbox.split('\n');
var rows=arraytxt.length;
for (i=0;imaxrows)
textbox.rows=maxrows;
else
textbox.rows=rows;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.