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 8381829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:47:05+00:00 2026-06-09T16:47:05+00:00

I am trying to use this jQuery plugin http://bassistance.de/jquery-plugins/jquery-plugin-validation so I can validate a

  • 0

I am trying to use this jQuery plugin http://bassistance.de/jquery-plugins/jquery-plugin-validation so I can validate a form I am making. But it does not seem to validate the phone field. Can anyone help me understand what did I do wrong?

This is my code so far

<script type="text/javascript">
 var validator
 jQuery(document).ready(function() {
     validator = jQuery("#participateform").validate();
 });

function sendRequest(){ 
        var validform=validator.form();       
        if(validform)
        {
            alert("Form is valid");
        }
}
</script>

<form id="participateform" >
    <div class="table">
        <div class="tr">
            <div class="td">fullname</div>
            <div class="td">
                <input type="text" value="" id="fullname" name="fullname" class="required" />
            </div>
        </div>
        <div class="tr">
            <div class="td">your e-mail </div>
            <div class="td">
                <input type="text" value="" id="e-mail" name="e-mail" class="required email" />
            </div>
        </div>
        <div class="tr">
            <div class="td">area</div>
            <div class="td">
                <select id="area" name="area"></select>
            </div>
        </div>
        <div class="tr">
            <div class="td">Phone 1</div>
            <div class="td">
                <input type="text" value="" id="phone" name="phone" class="required phone"/>                
            </div>
        </div>
        <div class="tr">
            <div class="td">Phone 1</div>
            <div class="td">
                <input type="text" value="" id="phone2" name="phone2" />
            </div>
        </div>

    </div>

    <input type="button" id="btnsubmit" value="submit" onclick="sendRequest()"> 
</form>
  • 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-06-09T16:47:06+00:00Added an answer on June 9, 2026 at 4:47 pm

    The Source code to the library suggest that this library uses the following Validation Rules for Phones:

    jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
        phone_number = phone_number.replace(/\s+/g, "");
        return this.optional(element) || phone_number.length > 9 &&
            phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
    }, "Please specify a valid phone number");
    
    jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
        phone_number = phone_number.replace(/\s+|-/g,'');
        return this.optional(element) || phone_number.length > 9 &&
            phone_number.match(/^(\(?(0|\+44)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/);
    }, 'Please specify a valid phone number');
    
    jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
        phone_number = phone_number.replace(/\s+|-/g,'');
        return this.optional(element) || phone_number.length > 9 &&
            phone_number.match(/^((0|\+44)7(0|4|5|6|7|8|9){1}\d{2}\s?\d{6})$/);
    }, 'Please specify a valid mobile number');
    
    //Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
    jQuery.validator.addMethod('phonesUK', function(phone_number, element) {
        phone_number = phone_number.replace(/\s+|-/g,'');
        return this.optional(element) || phone_number.length > 9 &&
            phone_number.match(/^(0[1-3]{1}[0-9]{8,9})$/) || phone_number.match(/^(07[5-9]{1}[0-9]{7,8})$/);
    }, 'Please specify a valid uk phone number');
    

    So instead of doing this :

    <input type="text" value="" id="phone" name="phone" class="required phone"/>
    

    Try this for a US phone number:

    <input type="text" value="" id="phone" name="phone" class="required phoneUS"/>
    

    Or this for a UK phone number:

    <input type="text" value="" id="phone" name="phone" class="required phoneUK"/>
    

    OR this for a UK Mobile Phone Number

    <input type="text" value="" id="phone" name="phone" class="required mobileUK"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this tooltip plugin: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ . I can't seem to get
I am using this jQuery form validation plugin: http://docs.jquery.com/Plugins/Validation/Methods I am trying to use
I'm trying to use the jQuery validation plugin (from here --> http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) to
I am trying to use this plugin: http://docs.jquery.com/Plugins/Validation Where #user_new is the id for
I'm trying to use the autocomplete plugin for jQuery (this one http://docs.jquery.com/Plugins/Autocomplete ). My
Im trying to use this page slider jquery plugin, you can see the demo
I'm trying to use marquee plugin of jQuery. but i get this error in
I'm trying to use this plugin http://www.cssnewbie.com/example/equal-heights/plugin.html but haven't used much javascript before. It
I'm trying to use the JQuery Form plugin (http://jquery.malsup.com/form/) to upload a file and
I am trying to use the drop event of fancy captcha (http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin) but it

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.