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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:08:02+00:00 2026-06-12T08:08:02+00:00

I have a form and I want to validate my select box. <div id=wwctrl_add_savedAddressId

  • 0

I have a form and I want to validate my select box.

<div id="wwctrl_add_savedAddressId" class="wwctrl styled-select">
    <select id="add_savedAddressId" class="required savedAddress checkDropdown">
</div>

I used the jquery validator to validate it.

  initValidation: function(){
            $(this.initVariables.formId).validate({
                  ignore: ":hidden",
                  errorElement: "div",
                  errorPlacement: function(error, element) {
                        error.insertAfter(element.parent());
                  }
            });
  }

If the select box is equal to -Select- it will return an error.

$.validator.addMethod("check_item_dropdown", function(value, element) {  
                return this.optional(element) || value != "-Select-";   
} 

That code is working and it results to

<div id="wwctrl_add_savedAddressId" class="wwctrl styled-select">
      <select id="add_savedAddressId" class="required savedAddress checkDropdown error">
</div>
<div class="error" for="add_savedAddressId" generated="true"> Select item</div>

The error class is equal to the following css

select.error{
    border: 1px solid #F10016;
    height: 23px;
}

As i have observed that the jquery validator is the one who appends the “error” class on the element itself.

The problem is, If i am validating a select box, I want the error class to be on the parent of the select box (in this case #wwctrl_add_savedAddressId) because I want the red color border be placed on the div instead of the select box itself. Why? Because our select box design has a background image and the select box itself is under that image.

How can i set my requirements using the validator?

Note: I have many select box that I need to validate like this.
Thank you.

  • 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-12T08:08:04+00:00Added an answer on June 12, 2026 at 8:08 am

    try to hack it if you don’t have access to the validator code.
    try something like this

    ...
    errorPlacement: function(error, element) { 
        error.insertAfter(element.parent()); 
        if (element.is('select')) {
            element.removeClass('error');
            element.parent().addClass('error');
        }
    }
    ... 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i have a JSP page that contain a form, i want to validate
I'm using the jQuery plugin Validation to validate a form. I have a select
i have very simple basic form in HTML and i want to validate the
I have a form that I want to be validated before showing it initially.
I have a form that validates the email address and I want to be
I have form and I want to send values from it with ajax to
i have a form and want to submit it with a script. i'm going
I have a form which I want to be 'resusable' for a variety of
I have a form that i want to appear at the top of every
I have a form that i want an administrator to fill out, then click

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.