Jump to content


Control Textarea - Email Form


2 replies to this topic

#1 Raven-X

    Young Padawan

  • Members
  • Pip
  • 71 posts
  • Gender:Male
  • Location:New Jersey
  • Interests:I love having fun, programming, web design, graphic design, gaming, anime, manga, and being a student (love learning new software).

Posted 21 May 2009 - 09:49 PM

Website

Click into the textarea and see that the cursor from the mouse doesn't automatically start at the left side....it can also click into the middle and this is not what I want. The default cursor position should be all the way to the left, like most forms. The textarea is the message form, the biggest one.

Does anyone know how to make the form so that the cursor will always be at the default to the left side and so that when a user is typing a long message, no horizontal scroll bar will be within the textarea? I'd rather the message automatically wrap around to the next line.

Edited by Raven-X, 21 May 2009 - 09:50 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 May 2009 - 10:34 PM

The default cursor position for all elements in a form is left unless rtl page display is enabled. What you're seeing is an illusion caused by excessive whitespace in the HTML.
		<p><strong>Message:</strong><textarea name="body" id="body" rows="" cols="">
				</textarea>
	
		<input type="submit" id="submit" value="Send Reply" class="submitButton" /></p>
The closing textarea tag should be right after the opening textarea tag. Other wise, all content between the two (whitespace included) will appear as the "default value" of the textarea. Also, the only thing that should cause a horizontal scrollbar would be non-breaking text (i.e. no white space). Though, if you are having problems with a horizontal scrollbar regardless of white space, the following topic may help clear something up (i just skimmed over it, it sounded right):
http://www.sitepoint...ead.php?t=80439

Edited by rc69, 21 May 2009 - 10:35 PM.


#3 Raven-X

    Young Padawan

  • Members
  • Pip
  • 71 posts
  • Gender:Male
  • Location:New Jersey
  • Interests:I love having fun, programming, web design, graphic design, gaming, anime, manga, and being a student (love learning new software).

Posted 22 May 2009 - 12:33 AM

<h1>Contact Us</h1>

<!-- Begin Form Elements -->
<fieldset>
	<form action="contactus.php" method="post">	
		<p><strong>Name:</strong> <input type="text" name="name" id="name" /></p>
		
		<p><strong>E-mail:</strong><input type="text" name="email" id="email" 
		value="<?php echo htmlspecialchars($email); ?>" />
		<span class="emailConfirmationMoveOver">(a confirmation e-mail will be sent to you.)</span></p>
		
		<p><strong>Message:</strong><textarea name="body" id="body" rows="" cols=""><?php echo htmlspecialchars($body); ?></textarea>
		
	
		<input type="submit" id="submit" value="Send Reply" class="submitButton" /></p>
	</form>
</fieldset>
<!-- End Form Elements -->

Fixed the spacing issue, apparently I forgot that PHP code (<?php echo htmlspecialchars($body); ?>) will never show up in the source code. I feel so embarrassed. xD This is the actual first form I've built and it validates the email, quite proud I must say.

Also, I've fixed the wrapping problem. Out of laziness, I was actually dragging a single string across the screen, not knowing a single string won't wrap. Thanks a lot man, it's all "wrapped" up now. lol

Edited by Raven-X, 22 May 2009 - 12:33 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users