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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:49:24+00:00 2026-06-09T23:49:24+00:00

I have one dropdown with condition like Required, Option and hidden for around 8

  • 0

I have one dropdown with condition like Required, Option and hidden for around 8 text fields. Few fields are getting validation and throwing error message even fields are hiding. How to avoid this? Please help on this.

My code is:

            function responseFunction(res) {
    //1:mandatory
    //2:optional
    //3:hidden
    var str = res.split("~");
   for (i in str)
    {
     var field= str[i].split(':');
            switch (field[0]) {
            case "BillingAddressLine1": 
                 switch (field[1]) {                    
                  case "1":$('#ContentSection_lblBillingInfoAddress').prepend('<span>*</span>');
                  $("#<%= txtBillingInfoAddress.ClientID %>").rules("add", {required  : true, messages : {
                  required    : 'Please Enter Address'   }});
                  break;
                  case "3":$('#ContentSection_lblBillingInfoAddress, #ContentSection_txtBillingInfoAddress').hide().parent('p').css("paddingTop", "0px");
                  break;
                 }
            break;
            case "BillingFullName": 
                 switch (field[1]) {
                  case "1":$('#ContentSection_lblBillingInfoAccountHolderName').prepend('<span>*</span>');
                   $("#<%= txtBillingInfoAccountHolderName.ClientID %>").rules("add", {required  : true, messages : {
                  required    : 'Please Enter Account Holder Name'   }});
                  break;
                  case "3":$('#ContentSection_lblBillingInfoAccountHolderName, #ContentSection_txtBillingInfoAccountHolderName').hide().parent('p').css("paddingTop", "0px");
                  break;
                 }
            break;
    }
    }

My screenshot is:
https://www.dropbox.com/sh/asmpnuiqqlo40us/S9yHCuNSyl?m#f:errorThrowing.jpg

  • 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-09T23:49:26+00:00Added an answer on June 9, 2026 at 11:49 pm

    Just put a check in the case statements like below

    var control = $("#<%= txtBillingInfoAddress.ClientID %>");
    if($(control).is(':hidden')){
      // remove validation
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my forms I would like to have a dropdown (sfWidgetFormChoice) where
i 2 Dropdown controls and 1 text box In drop down1 one i have
I have simple form. It contains few texboxes and one dropdown list. And I
I have a one dropdown box in webpage that is with autopostback = true
I have two dropdown ddlCountry and ddlState and one button Submit. While ddlstate is
I have dropdown-Lists which have a lot of elements (>1000). When I select one
i have a time dropdown that shows hour in one select, minutes in another
I have an ESRI dropdown control inside of an ESRI toolbar. One of the
INSERT MODE i have check box in one tr. and another dropdown control in
I am using Asp.net dropdownlist in one of my form ..I have two dropdown

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.