Help - Search - Members - Calendar
Full Version: Control Textarea - Email Form
Pixel2Life Forum > Help Section > HTML, XHTML, CSS and General Web Design
Raven-X
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.
rc69
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.
CODE
        <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.com/forums/showthread.php?t=80439
Raven-X
CODE
<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
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.