Solved

Help changing format of controls in Frontpage 2000

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now