Solved

Help changing format of controls in Frontpage 2000

Posted on 2004-04-08
2
140 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
Comment Utility
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
Comment Utility
Thanks,
Just3082
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
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 automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…

743 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

18 Experts available now in Live!

Get 1:1 Help Now