Forum Moderators: open

Message Too Old, No Replies

Forms and Phone Numbers

Looking for appropriate code

         

RichLear

10:21 pm on Dec 26, 2008 (gmt 0)

10+ Year Member



I am trying to find the appropriate code for a phone number form. I would also like to be able to dictate how the form is delivered to me. I work in Dreamweaver and my current knowledge allows me to put the text field in and require it to be validated. However, in order for it to come in the order I have it listed I have to give each input name a number. If I don't it comes in alphabetical order.

I would like the phone number to be 3 text fields that the cursor advances to as you type, not requiring the tab button. I would also like the number to come to me all together. I found fieldset, but must be doing something wrong. I get a box around the set, which I don't want and it does not deliver it to me in one line.

Below is the code I am currently using. Any help would be appreciated. Thanks, Richard

<form action="gdform.asp" method="post" name="index" target="_self" class="paragraph" id="index" onSubmit="MM_validateForm('1FirstName','','R','2LastName','','R','3Phone','','RisNum','4Email','','RisEmail');return document.MM_returnValue">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="28%" valign="top"><h3 align="right"><strong>First Name</strong></h3></td>
<td width="72%"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><span class="style4">
<input name="1FirstName" type="text" id="1FirstName" onBlur="MM_validateForm('1FirstName','','R');return document.MM_returnValue" size="25" maxlength="50">
</span></font></td>
</tr>
<tr>
<td valign="top"><h3 align="right"><strong>Last Name</strong></h3></td>
<td>
<input name="2LastName" type="text" id="2LastName" onBlur="MM_validateForm('2LastName','','R');return document.MM_returnValue" size="25" maxlength="50"> </td>
</tr>
<tr>
<td valign="top"><h3 align="right">Gender</h3></td>
<td><label>
<input type="radio" name="radio" id="Male" value="Male">
</label>
<strong>Male
<label> </label>
</strong>
<label>
<input type="radio" name="radio" id="Female" value="Female">
</label>
<strong>Female</strong></td>
</tr>

<tr>
<td valign="top"><h3 align="right"><strong>Phone Number</strong></h3></td>
<td><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">
<fieldset>
<input name="3Phone" type="text" id="3Phone" onBlur="MM_validateForm('3Phone','','RisNum');return document.MM_returnValue" size="3" maxlength="3">
-
<input name="phone2" type="text" id="phone2" size="3" maxlength="3">
-
<input name="phone3" type="text" id="phone3" size="4" maxlength="4"></fieldset>
</font></td>
</tr>
<tr>
<td valign="top"><h3 align="right"><strong>Email Address</strong></h3></td>
<td><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">
<input name="4Email" type="text" id="4Email" onBlur="MM_validateForm('4Email','','RisEmail');return document.MM_returnValue" size="25" maxlength="50">
</font></td>
</tr>

<tr>
<td valign="top"><h3 align="right"><strong>Comments</strong></h3></td>
<td><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">
<textarea name="5Comments" cols="30" rows="10" id="5Comments"></textarea>
</font>
<br>
<br><input type="submit" name="Submit" value="Swimming Should Be Fun" id="Submit"> </td>
</tr>
</table>
<br class="clearFloat" />
</form>

g1smd

10:28 pm on Dec 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What sort of phone numbers?

In the UK; all these formats are correct:

0114 789 1234 (area codes with 011n)
0161 789 1234 (area codes with 01n1)
01225 678123 (area codes with 01nnn)
020 7890 1234 (area codes with 02n)
07890 789123 (mobile numbers 07nnn)

Then ya got various 030, 034, 037, 080, 084, 087 and 09 codes too.

Finally, a few places int' middle of nowhere don't follow the normal rules and only have a five digit number (instead of six) or have a longer than normal code.

Complicated business is phone numbers.

RichLear

10:36 pm on Dec 26, 2008 (gmt 0)

10+ Year Member



On this form they are local US numbers, but on another form they are phone numbers from all over the world.

g1smd

10:42 pm on Dec 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You'll need to cater for all sorts of possibilities. Whether you'll be able to validate that input is another matter... nothing more infuriating for customers having to enter some data but the boxes don't allow the correct format (or are too small) and you can't send without inputting something - so you end up filling it in with incorrect data.

I have filled in phone number boxes with 001 001 0001 before now because they wanted exactly that format but MY number has ELEVEN digits in all and is 5 + 6 format and not 3 + 3 + 4. There was no point in submitting my number but with a digit missing - totally useless.

RichLear

11:02 pm on Dec 26, 2008 (gmt 0)

10+ Year Member



You have a point. I guess I can just make it an open box and make it required without forcing it to be a number.