Solved

Help changing format of controls in Frontpage 2000

Posted on 2004-04-08
2
143 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Source Safe 2005 on Windows Server 2012 R2 10 1,556
Web Modal Window 1 77
Visual Studio Professional 2015 4 73
Web Development Tools for MVC 3 90
When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
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 update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

786 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