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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:27:06+00:00 2026-06-12T20:27:06+00:00

I have a form that is validated by the validate jquery plugin. <form action=

  • 0

I have a form that is validated by the validate jquery plugin.

<form action="" id="contact-form" class="form-horizontal">
    <fieldset>
        <div class="control-group">
            <label class="control-label" for="name">Nome:</label>
            <div class="controls">
                <input type="text" class="input-xlarge" name="name" id="name" placeholder="Indique o seu nome" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="email">Email:</label>
            <div class="controls">
                <input type="email" class="input-xlarge" name="email" id="email" placeholder="Indique o seu email" />
            </div>
        </div>
        <!-- ... -->
    </fieldset>
</form>

the script code:

$('form#contact-form').validate({
    rules: {
        name: {
            minlength: 2,
            required: true
        },
        email: {
            required: true,
            email: true
        },
        // ...
    },
    highlight: function(label) {
        $(label).closest('.control-group').addClass('error').removeClass('success');
    },
    success: function(label) {
        label.closest('.control-group').addClass('success');
    },
    submitHandler: function(form) {
        $('form#contact-form').slideUp("slow", function() {
            $(this).before('<div class="alert alert-success"><h4>Informação</h4>Mensagem Enviada com sucesso.</div>');
            setTimeout(function () {
                $('#modal').modal('hide');
            }, 3000);
        });
        return false;
    }
});

I have two questons:

  1. what they needed was that when an error was corrected, the .error
    class was removed and the generated label was removed.
  2. what is the rule that I have to put an element that I have a concrete value, for
    example the number 8?

when element contains a error, the code looks like:

<div class="control-group error">
    <label class="control-label" for="email">Email:</label>
    <div class="controls">
        <input type="email" class="input-xlarge" name="email" id="email" placeholder="Indique o seu email">
        <label for="email" generated="true" class="error" style="">Por favor introduza um endereço de email válido.</label>
    </div>
</div>

when the error is corrected, the code looks like:

<div class="control-group error success">
    <label class="control-label" for="name">Nome:</label>
    <div class="controls">
        <input type="text" class="input-xlarge" name="name" id="name" placeholder="Indique o seu nome">
        <label for="name" generated="true" class="error" style=""></label>
    </div>
</div>
  • 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-12T20:27:07+00:00Added an answer on June 12, 2026 at 8:27 pm
    1. Change your success function to this:

      success: function(label) {
          label.closest('.control-group').removeClass('error').addClass('success');
      }
      

      It is not wise to remove the generated=true param from the html-tag. I’ve done that in the past and it only add troubles to the validation functionality.

    2. You can add a method:

      $.validator.addMethod("equalTo", function(value, element, param) { return (value == param); });
      

      than in your rules:

      name: {
          minlength: 2,
          required: true,
          equalTo: "8"
      } 
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that is using jQuery Validate plugin for client side validation,
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
I've a form that is being validated with Jquery's Validation Plugin and I need
I have an issue with the jquery validate plugin that doesn't make sense to
I am using the jquery validation plugin to validate a form. I have the
I have a form which I am validating through the jQuery Validate plugin. Everything
I have a html form and validated it using jquery bassitance plugin, then after
I am using jquery validation plugin to validate my form. I have one field
I have a form that adds an error class to the parent div for
I am Using jquery validate() plugin . i hava a combobox in form that

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.