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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:43:20+00:00 2026-05-25T02:43:20+00:00

when i select a type from a drop down box the form fields are

  • 0

when i select a type from a drop down box the form fields are changing .
changing means hiding or showing , so according to the drop-down value the form fields are hiding and showing , i need to add j query validation plugin to this form ,

i have a input

<div class="form-item">
                                                        <div class="catergory-inputs">
                                                            <input name="address" type="text" class="textarea_medium"
                                                                id="Address" value="<?php echo $address['value'] ; ?>" />
                                                        </div>
                                                    </div>

i validate this

 var x=$("#contactinfo").validate({
            rules: {

                address: {
                    required: true,
                    minlength: 3,
                    maxlength: 50,
                    lettersonly: true                   
               },
 },

            messages: {

                address: {
                    required: "Enter your Address",
                    minlength: "At least 3 characters long"
                },
            }
        }); 

i want to validate this field if only this field is not hiding . like this

 var x=$("#contactinfo").validate({
            rules: {
                if(not hiding) {
                address: {
                    required: true,
                    minlength: 3,
                    maxlength: 50,
                    lettersonly: true
                   } 
               },
 },

            messages: {
                if(not hiding) {
                address: {
                    required: "Enter your Address",
                    minlength: "At least 3 characters long"
                  } 
                },
            }
        }); 

how can i do this , i saw similar questions in stack-overflow .but there were no answer to mh question there , plz help me ……………………….. 🙁

  • 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-05-25T02:43:20+00:00Added an answer on May 25, 2026 at 2:43 am

    I wanted to conditionally validate a username field to make sure it was not in the database but only on creating a new user. So when creating a new I placed a javascript variable var newUser=true; else editing existing user var newUser=false;

    Then in my rules portion of my validate I put required: (newUser)?true:false

    This causes validate to validate the username field only if new user is true. If we loaded up an existing user, then the required portion of the rule will have the value false simply by adding the javascript var in your PHP code.

    Remember, you can put javascript into a json object. Because it’s all javascript!

    These are the resources I used in learning about validate: http://www.ferdychristant.com/blog//articles/DOMM-7LZJN7 //article detailing how to really use validate. http://www.ferdychristant.com/blog//pages/jQuery%20validation%20code
    http://randomactsofcoding.blogspot.com/2008/10/starting-with-jquery-how-to-write.html
    http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression

    There is also an amazing depth of information simply in http://docs.jquery.com/Plugins/Validation …you just gotta click through it all!

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

Sidebar

Related Questions

Im using Ajax to get a value from the Drop down box and display
i want to hide and show my text box according to drop down select
I have a Tabular type Form based upon a SELECT * FROM table type
I'm in need to toggle divs from a dropdown select option box. I'd like
I'm trying to get the selected value from a drop down list via jQuery.
Possible Duplicate: How can I get drop down menu value still selected after form
select distinct constraint_type from user_constraints; C - C P R U Seems P means
and get meaningful results. Currently I am running these three queries: SELECT t.type,t.id,s.title FROM
I want to SELECT a formatted date string from a datetime type in SQL
INSERT INTO [Tasks] ([LoginName] ,[Type] ,[Filter] ,[Dictionary] ,[Description]) Select N'Anonymous',4,'SomeTable.targetcode in (select Code from

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.