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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:43:32+00:00 2026-06-15T10:43:32+00:00

I have javascript validation code, now I want to prevent . ; , `

  • 0

I have javascript validation code, now I want to prevent . ; , ` :

this my code so far :

jQuery.validator.addMethod("noSpace", function(value, element) {
    return !value.match(/\s/g);
});

$().ready(function() {
    $("#signup_form").validate( {
        rules: {
            full_name: "required",
            username: {
                required: true,
                minlength: 2,
                noSpace: true,
            },
            password: {
                required: true,
                minlength: 5
            },
            email: {
                required: true,
                email: true
            },
        },
        messages: {
            full_name: "<div class='spacing'>Please enter your full name</div>",
            username:
            {
                required: "<div class='spacing'>Please enter an username</div>",
                minlength: "<div class='spacing'>Your username must consist of at least 2 characters</div>",
                noSpace: "<div class='spacing'>No space allowed</div>",
            },
            password:
            {
                required: "<div class='spacing'>Please provide a password</div>",
                minlength: "<div class='spacing'>Your password must be at least 5 characters long</div>"
            },
            email: "<div class='spacing'>Please enter a valid email address</div>"
        }
    });
});

I want to prevent in username rules. So if I input . , ; etc, it will show message that it can’t allowed.

  • 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-15T10:43:32+00:00Added an answer on June 15, 2026 at 10:43 am

    Not tested, but this should work:

    jQuery.validator.addMethod("userNameRule", function(string, element) { 
        return !string.match(/[.;,]/g);
    }, "Your username contains invalid characters!");
    
    username: {
        required: true,
        minlength: 2,
        noSpace: true,
        userNameRule: true
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaScript validation function and a jquery progress bar. onclick of a
I have JavaScript form validation functions like so: function validate_name(field) { if (field ==
I have created a signup page on my site, but the javascript validation function
I have javascript code some thing like this -- var count=3; var pl=new Array(count);
I have Javascript function defined in the main index.html file. One part of this
I have a javascript function that posts data to a validation script and grabs
I am using javascript unobtrusive validation. I have a view model that I am
I have designed a webpage using HTML and client side validation using JavaScript.PHP for
how to append error messages on validation summary through javascript. i have added a
I have a validator which I can enable or disable using the following javascript:

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.