dizzytri99er
dizzytri99er

Reputation: 930

HTML field formatting

I have a standard HTML form.

<form method="post" name="myemailform" action="form-to-email.php">
    Enter Name: <input type="text" name="name">
    Enter Email Address:    <input type="text" name="email">
    Enter Message:  <textarea name="message"></textarea>
    <input type="submit" value="Send Form">
</form>

The problem is that when a value is input that is larger than the field size, upon clicking away, the field skips back to the beginning of the field so the end is cut off.

Is there a way to get it so that the view of the field stays where the carat was?

Upvotes: 0

Views: 508

Answers (2)

Teena Thomas
Teena Thomas

Reputation: 5239

You can use the HTML attribute size.

Upvotes: 0

Mickle Foretic
Mickle Foretic

Reputation: 1409

This is a javascript problem (client side), not a PHP one (server side).

You need to do this:

<input type="text" name="name" size="10" onblur="if (this.length > 10) {this.dir = 'rtl';} else {this.dir = 'ltr';}">

just check what is the proper length to use in order to change the input direction

Upvotes: 5

Related Questions