Solved

Help changing format of controls in Frontpage 2000

Posted on 2004-04-08
2
145 Views
Last Modified: 2013-12-24
Have a phone number field in my form that I want to autoformat as a phone number, i.e. (XXX)XXX-XXXX

Can someone give me some insight on this ??

Thanks,

Just3082
0
Comment
Question by:just3082
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
rcmb earned 125 total points
ID: 10788492
My recommendation is to create seperate text boxes for each and then create the auto tab script

Here is a sample of the two boxes with auto tab:

<script>
//auto tab script
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
if(isNN)
  document.captureEvents(Event.KEYPRESS);
      function autoTab(input,len, e) {
      var keyCode = (isNN) ? e.which : e.keyCode;
      var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
      if(input.value.length >= len && !containsElement(filter,keyCode)) {
      input.value = input.value.slice(0, len);
      input.form[(getIndex(input)+1) % input.form.length].focus();
      }
      function containsElement(arr, ele) {
      var found = false, index = 0;
            while(!found && index < arr.length)
      if(arr[index] == ele)
            found = true;
      else
            index++;
      return found;
      }
      function getIndex(input) {
      var index = -1, i = 0, found = false;
            while (i < input.form.length && index == -1)
      if (input.form[i] == input)index = i;
      else i++;
      return index;
      }
return true;
}
</script>
<form method="POST" action="--WEBBOT-SELF--">
  <p>
  <INPUT TYPE="text" NAME="Phone1" SIZE="3" MAXLENGTH="3" VALUE=""  onKeyUp="return autoTab(this, 3, event);" onBlur="this.value=checkNumber(this.value);">-<INPUT TYPE="text" NAME="Phone2" SIZE="4" MAXLENGTH="4" VALUE=""  onKeyUp="return autoTab(this, 4, event);" onBlur="this.value=checkNumber(this.value);">
  (format = 123-1234)<p>
  &nbsp;<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></form>

When you write to the database (if you are doing this), the sql will look something like

INSERT INTO Table (PnoneNum) VALUES ('::Phone1::-::Phone2::')


If you want the area code then add a line above phone1 like

<INPUT TYPE="text" NAME="AreaCode" SIZE="3" MAXLENGTH="3" VALUE=""  onKeyUp="return autoTab(this, 3, event);" onBlur="this.value=checkNumber(this.value);">

and make your sql read .... VALUES ('::AreaCode::-::Phone1::-::Phone2::')

Hope this helps
RCMB
0
 

Author Comment

by:just3082
ID: 10793988
Thanks,
Just3082
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Renaming file after uploading in Coldfusion 4 288
Web Development Tools for MVC 3 112
Search on a site 5 137
Dreamweaver server behavior gone 6 165
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question