input value question

H

hhservices

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
 
J

Jukka K. Korpela

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>
 
A

Adrienne Boswell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top