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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:33:36+00:00 2026-06-18T06:33:36+00:00

I use Validate.Js to validate my HTML form using jQuery & it works perfectly.

  • 0

I use Validate.Js to validate my HTML form using jQuery & it works perfectly.
But I need to show the errors beside each field, instead it shows a summary of all errors at the top of the page.

HTML:

<div class="success_box">All of the fields were successfully validated!</div>
<div class="error_box"></div>

    <form name="example_form">
    <label for="req">Required field:</label>
    <label for="alphanumeric">Alphanumeric field:</label>
    <div id="AlphaNumeric"></div>

    <input name="req" id="req" />
    <input name="alphanumeric" id="alphanumeric" />

    <label for="password">Password:</label>
    <label for="password_confirm">Password Confirmation (match password):</label>

    <input name="password" id="password" type="password" />
    <input name="password_confirm" id="password_confirm" type="password" />

    <label for="email">Email:</label>
    <label for="minlength">Min length field (min. 8 chars):</label>

    <input name="email" id="email" />
    <input name="minlength" id="minlength" />

    <label for="tos_checkbox">Required checkbox (example: Terms of Service)</label>
    <input name="tos_checkbox" id="tos_checkbox" type="checkbox" />

    <button class="button gray" type="submit" name="submit">Submit</button>
</form> 

JavaScript:

    new FormValidator('example_form', [{
    name: 'req',
    display: 'required',    
    rules: 'required'
    }, {
    name: 'alphanumeric',
    rules: 'alpha_numeric'
    }, {
    name: 'password',
    rules: 'required'
    }, {
    name: 'password_confirm',
    display: 'password confirmation',
    rules: 'required|matches[password]'
    }, {
    name: 'email',
    rules: 'valid_email'
    }, {
    name: 'minlength',
    display: 'min length',
    rules: 'min_length[8]'
    }, {
    name: 'tos_checkbox',
    display: 'terms of service',
    rules: 'required'
    }], function(errors, event) {
    var SELECTOR_ERRORS = $('.error_box'),
        SELECTOR_SUCCESS = $('.success_box');

    if (errors.length > 0) {
        SELECTOR_ERRORS.empty();

        for (var i = 0, errorLength = errors.length; i < errorLength; i++) {
            SELECTOR_ERRORS.append(errors[i].message + '<br />');
        }

        SELECTOR_SUCCESS.css({ display: 'none' });
        SELECTOR_ERRORS.fadeIn(200);
    } else {
        SELECTOR_ERRORS.css({ display: 'none' });
        SELECTOR_SUCCESS.fadeIn(200);
    }

    if (event && event.preventDefault) {
        event.preventDefault();
    } else if (event) {
        event.returnValue = false;
    }
    });

Is there a method to change the display style? And are there any better scripts that can do this?

  • 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-18T06:33:37+00:00Added an answer on June 18, 2026 at 6:33 am

    Quote: “But I need to show the errors beside each field, instead it shows a summary of all errors at the top of the page. … … Is there a method to change the display style?”

    NO. As per documentation, there is no listed option for how to place the error messages.

    Since the plugin’s description says, “Modeled off the CodeIgniter form validation API”, that tells me that the whole point is to show error messages in a single summary box above the form just like CodeIgniter validation does. You simply chose the wrong plugin if you want individual error messages next to each field.

    Quote: “… And are there any better scripts that can do this?”

    YES. The jQuery Validate plugin is developed by someone from the jQuery team. There is a huge base of support and tons of options.

    “The plugin is written and maintained by Jörn Zaefferer, a member of
    the jQuery team, lead developer on the jQuery UI team and maintainer
    of QUnit. It was started back in the early days of jQuery in 2006, and
    updated and improved since then.”

    http://bassistance.de/jquery-plugins/jquery-plugin-validation/

    http://docs.jquery.com/Plugins/Validation/

    By default, errors are shown “next to” each field.

    See demo: http://jsfiddle.net/UGyXP/

    jQuery:

    $(document).ready(function() {
    
        $('#myform').validate({ // initialize the plugin
            rules: {
                field1: {
                    required: true,
                    minlength: 5
                },
                field2: {
                    required: true,
                    email: true
                }
            }
        });
    
    });
    

    HTML:

    <form id="myform">  
         <input type="text" name="field1" />
         <input type="text" name="field2" />
         <input type="submit" />
    </form> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to validate a form using the jquery validate plugin, but I'm unable
I'm using this two plug-ins jquery.validate and jquery.form separately, but I would like to
So I'm using jQuery and the validation plugin to validate form input on the
I'm using jquery.validate plugin and facing the following situation: <form id=myForm ....> <input type=text
I'm trying to use jQuery validation plugin to validate a few form fields by
I've got a simple HTML file upload form. I'm using the jQuery validation plugin
I use jquery form wizard to show a form in two steps. Before proceeding
Html form is controlled using Knockout JS and jQuery templates. Basic jQuery validation is
I have the following form. I am trying to validate the inputs using jquery
I'd like to use the jQuery.Form/Validate plugins to only allow my form to be

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.