Jump to content

Textarea Help


brax23

Recommended Posts

I'm having trouble with a bit of code.  The code below shows I am producing 2 pull down menus and 2 text areas all on one row.  I would like to adjust the width of the last input box and also number of rows it spans.  I'm trying to use the 'textarea' tag but I can;t quite figure it out.  Can anyone help please?

echo "<form method='get' action='Time_3.php'>";
echo "<table border='0' width='50%' cellspacing='0' cellpadding='8'>";
echo "	<tr>";
echo "		<td><table border='0' width='100%' cellspacing='0'>";
echo "			<tr>";
echo "				<td width='5%'> </td>";

echo "			</tr>";
echo "			<tr>";
echo "				<td width='5%'> </td>";
echo "				<td width='95%'> </td>";
echo "			</tr>";
echo "			<tr>";
echo "				<td colspan='1'><table border='0' width='40%'>";
echo "					<tr>";
echo "						<td>Project: </td>";
echo "                                          <td>Task Code: </td>";
echo "						<td>Time: </td>";
echo "						<td>Description: </td>";
echo " <tr></tr>";
echo "						<td>$members_list</td>";
echo "						<td>$codes_list</td>";
echo "                                          <td><input type='text' name='time1' > </td>";
echo "                                          <td cols='2'> <input type='text' name='description1' ></td>";

echo "					</tr>";
echo "				</table></td>";
echo "			</tr>";
echo "		</table></td>";
echo "	</tr>";
echo "</table>";
echo "<input type='submit' value='Submit' />";

echo "</form>";

Link to comment
Share on other sites

Thank you adam84 this did work to adjust the text area.  Please excuse my low knowledge level but I need to ask a couple more questions.  I' using the code below after reading your hint.However, the <input type='text' name='description1> code shows up in the text box and I would like to enter data in the text area.  Also, the "resized" text box is centering vertically in the middle of the row.  Is it possible to have it align with the top of the row?  Thanks very much for the help.

<td><TEXTAREA COLS=100 ROWS=3 ID=txt><input type='text' name='description1'></TEXTAREA></td>

Link to comment
Share on other sites

This code allows me to control the length of the text field but I would still like to have the text box span several rows while aligning with the top of the row, if that make any sense.

<td><input type='text'name='description1' size='100'/></td>

Link to comment
Share on other sites

Text in a text area

<td>
     <TEXTAREA COLS=100 ROWS=3 ID=txt>
                      The text you want to show up in a text area goes between the <textarea> tags
     </TEXTAREA>
</td>

 

To set an element to the top of a cell, <TR VALIGN=TOP>

More info: http://www.htmlcodetutorial.com/tables/_TR_VALIGN.html

 

To span a couple rows, you need to use ROWSPAN in your <TD>

This should help you out: http://www.htmlcodetutorial.com/tables/index_famsupp_30.html

 

FYI, a textarea doesnt have the attribute MAXLENGTH like a text field does, so if you want to set the character length of your text area you have to create/find a JS function that limits the input.

Link to comment
Share on other sites

<td><TEXTAREA COLS=100 ROWS=3 ID=txt><input type='text' name='description1'></TEXTAREA></td>

 

I really don't like this code. It uses tables  :( , but the worse part is your use of "cols" and "rows." Such things should be styled through css. Lastly, the <input> tag is unnecessary to accomplish what you are trying to do. It simply defeats the purpose of the textarea.

 

<textarea id="textarea1 name="textarea1">Please write something...</textarea>

 

#textarea1 {
  width: 300px
  height: 50px;
  background: ...; etc.
}

Link to comment
Share on other sites

the worse part is your use of "cols" and "rows." Such things should be styled through css.

 

I agree, and they still can be, but cols and rows are required (by XHTML strict at least, don't know about transitional).

 

Really? I never really used textarea much before, so this is completely new to me... but why? Seems like an IE4 thing to me.  :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.