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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:11:31+00:00 2026-06-18T03:11:31+00:00

I am working on signup form. I’ve validated the fields for required, minlength etc,

  • 0

I am working on signup form. I’ve validated the fields for required, minlength etc, and placed validate error message before an element like this:

$('#register').validate(
{
    rules: 
    {
        username: 
        {
            required: true,
            minlength: 6
        },
        email: 
        {
            required: true,
            email: true
        },
        password: 
        {
            required: true,
            minlength: 8
        },
        confirmPassword: 
        {
            required: true,
            equalTo: '#password'
        }
    },
    messages: 
    {
        username:
        {
            required: 'Please enter username',
            minlength: 'Username too short'
        },
        email: 
        {
            required: 'Please enter email',
            email: 'Invalid E-Mail'
        },
        password:
        {
            required: 'Please enter password',
            minlength:'Password too short'
        },
        confirmPassword: 
        {
            required: 'Please provide password',
            equalTo: 'Passwords don\'t match'
        }
    },
    errorPlacement: function(error, element)
    {
        error.insertBefore(element);
    }
});

All is fine while client side validation, but I’ve to check for the server side validation too, like username duplication, email duplication… So if username already exists, and I’ve to place validate error message before an element again, then how it would be? I’ve done all ajax, request and php/mysql coding and returning error message. Just I’ve to display before an element with same style as jquery validating do.

  • 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-18T03:11:32+00:00Added an answer on June 18, 2026 at 3:11 am

    You can add custom validation functions to each element. like for example say you need to add ajax validation to “username” field, this can be done as follows

    $.validator.addMethod("validateUserName", function(val, element) {
    
        $.ajax({
            type : "post",
            async: false,
            url : YOUR_URL,
            data : {'username': val},
            dataType : 'json',
            error : function(jqXHR, textStatus, errorThrown){
                //alert("some error occured while submitting the form");
                return false;
            },
            success : function(  response,  textStatus,  jqXHR ){
                //Assuming you return true in server reply
                if( response.status == true ){
                    //Username valid
                    return true;
                } else {
                    //Invalid Username
                    return false;
                }
            }
        });
    }, "Username Already exists.");
    

    And your validation js will look somehting like this

    $('#register').validate(
    {
        rules: 
        {
            username: 
            {
                required: true,
                minlength: 6,
                validateUserName: true,
            },
     .....
    

    So now when there is a repeat username, the custom error “Username Already exists.” will be shown in its error label.

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

Sidebar

Related Questions

I am working on a signup form, I am using PHP and on my
I'm working on an email series signup form that needs to have a checkbox
I have got a simple signup form that uses jQuery validate to validate the
I'm working on an internal signup form for classes. I am working on a
I am working on login/signup module(FYI no rolls/membership just a simple login form),data flow
I have the following script to validate my form. It is working fine but
I'm working on a signup form using jQuery's AJAX and Codeigniter PHP framework, but
I'm working on signup form and I have 2 steps to user register in
Working with H2 I get this error when I try to write a row
I'm working on a signup page in CodeIgniter. The problem is, my post data

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.