Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7248011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:04:55+00:00 2026-05-28T22:04:55+00:00

For a phone validation I am using in prototype.js a … <body onload=Xaprb.InputMask.setupElementMasks()> That

  • 0

For a phone validation I am using in prototype.js a …

<body onload="Xaprb.InputMask.setupElementMasks()">

That is actually an older version (1.4) and an upgrade to (1.7) would not work. Here is the code placed into the page…

<script type="text/javascript" language="javascript">
//<![CDATA[
if ( typeof(Xaprb) == 'undefined' ) {
   Xaprb = new Object();
}

Xaprb.InputMask = {
masks: {
phone: {
         format: '(   )   -    ',
        regex:  /\d/
      }
      },
      setupElementMasks: function() {
      if ( document.getElementsByClassName ) { // Requires the Prototype library
         document.getElementsByClassName('input_mask').each(function(item) {
            Event.observe(item, 'keypress',
               Xaprb.InputMask.applyMask.bindAsEventListener(item), true);
         });
      }
   },
   applyMask: function(event) {
      var match = /mask_(\w+)/.exec(this.className);
      if ( match.length == 2 && Xaprb.InputMask.masks[match[1]] ) {
          var mask = Xaprb.InputMask.masks[match[1]];
     var key  = Xaprb.InputMask.getKey(event);

         if ( Xaprb.InputMask.isPrintable(key) ) {
            var ch      = String.fromCharCode(key);
            var str     = this.value + ch;
            var pos     = str.length;
        if ( mask.regex.test(ch) && pos <= mask.format.length ) {
           if ( mask.format.charAt(pos - 1) != ' ' ) {
              str = this.value + mask.format.charAt(pos - 1) + ch;
           }
           this.value = str;
        }
        Event.stop(event);
     }
  }
  },
   isPrintable: function(key) {
      return ( key >= 32 && key < 127 );
   },
   getKey: function(e) {
      return window.event ? window.event.keyCode
           : e            ? e.which
           :                0;
   }
};
//]]>
</script>

Forgive me but I am fairly new to this subject if missing something simple. It basically validates the phone number as the customer types it in. This is located a http://www.comparediabetictestingsupplies.com and actually forces the sliders through jreviews not function (this is a Joomla! CMS). I also want to add, I changed all 75 ‘$’ to ‘_’ in prototype.js.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:04:55+00:00Added an answer on May 28, 2026 at 10:04 pm

    I ended up finding prototype.maskedinput.js that works with the prototype.js 1.6.1. This ended up changing the code around, but solved not only a conflict with jquery, but also mootools. You can find the source at https://github.com/bjartekv/MaskedInput/blob/master/prototype.maskedinput.js

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using regular expression. In phone validation, i have to use the +
Currently i am validating the validation form for phone number using the following code
I have to do phone number validation using JavaScript. I have already done validation
I am using zend form validation for a phone number. and I want, user
I'm making a form that I'm using the amazing JQuery validation plugin for (
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
I'm trying to perform some realtime phone-number validation using javascript. I don't need help
I'm trying to implement binding validation using Silverlight on Windows Phone, but all I
I have a form that i am validating using jquery the validation plugin. What
I've am using jQuery validation plugin to validate a mobile phone number and am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.