Solved

Help changing format of controls in Frontpage 2000

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
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 insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
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…

724 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