Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > input value question

Reply
Thread Tools

input value question

 
 
hhservices
Guest
Posts: n/a
 
      10-29-2003
My question pertains to a contact form where someone would type their
phone number. Example:
<input type="text" name="Phone" size="30" value="(include area code)">

The type of input that I am searching for is when the page is viewed
then words (include area code) would be visible in the form and then
when someone clicks the input box, then the words include area code
would disappear and then they could type their phone number with the
area code.

Thanks in advance,
Victor
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      10-30-2003
(hhservices) wrote:

> My question pertains to a contact form where someone would type their
> phone number. Example:
> <input type="text" name="Phone" size="30" value="(include area code)">


That's not a good approach, since the value attribute, if present, should
specify a useful initial (default) value for the field.

> The type of input that I am searching for is when the page is viewed
> then words (include area code) would be visible in the form and then
> when someone clicks the input box, then the words include area code
> would disappear and then they could type their phone number with the
> area code.


You could do that, with the usual caveats, using a simple piece of
JavaScript. But it is better to avoid creating the problem in the first
place. Use something like

<div>Please specify your full phone number, including area code.</div>
<div><label for="phone">Phone:</label>
<input type="text" id="phone" name="Phone" size="30"></div>

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      10-30-2003
(hhservices) wrote in message news:<. com>...
> My question pertains to a contact form where someone would type their
> phone number. Example:
> <input type="text" name="Phone" size="30" value="(include area code)">
>
> The type of input that I am searching for is when the page is viewed
> then words (include area code) would be visible in the form and then
> when someone clicks the input box, then the words include area code
> would disappear and then they could type their phone number with the
> area code.
>
> Thanks in advance,
> Victor


You could probably do something with Javascript, but IMHO, the best
thing to do is to place the instruction under the input box, just like
on a paper form.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read input value from dynamic created input controls Melissa ASP .Net 2 12-26-2008 07:48 AM
Form Input Value to change a later value Christa Lee Javascript 2 10-01-2005 07:56 PM
Getting value from asp:label into javascript input value Dwizz Javascript 10 08-07-2005 02:28 AM
Pass input Array value to function to calc different input value Susan Cranford Javascript 2 07-05-2005 02:53 AM
How to refer to a value of an input box within the <input...> tag? chirs Javascript 3 10-18-2003 12:21 AM



Advertisments