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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:45:46+00:00 2026-05-31T17:45:46+00:00

I have done some research on the above and found that I am able

  • 0

I have done some research on the above and found that I am able to use errorPlacement and some commands in order to achieve a portion of my work.

However; what I have is the following:

Option 1 – Two fields
Option 2 – Two fields

Depending if a user has the need for option 1 or 2, they need to enter both fields for EACH option they have chosen.

For example

<form>
<fieldset>
<div id="option1">
<input type="text" id="number" name="field1">
<input type="text" id="firstname" name="field2">
</div>
<div id="option2">
<input type="text" id="cardnumber" name="field3">
<input type="text" id="firstname" name="field4">
</div>
</fieldset>
</form>

So basically, if the user decides option 1 is best for them, both number and firstname need to be validated. If they choose option2, both cardnumber and firstname need to be validated.

  • 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-31T17:45:47+00:00Added an answer on May 31, 2026 at 5:45 pm
    function validate() {
        var number = $("#number").val();
        var numberFirstName = $("#firstname").val();
        var cardNumber = $("#cardnumber").val();
        var cardNumberFirstName = $("#c_firstname").val();
    
        if (number != "" && numberFirstName == "") {
            alert("Complete both fields on Option 1");
        }
    
        if (cardNumber != "" && cardNumberFirstName == "") {
            alert("Complete both fields on Option 2");
        }
    } 
    

    Note that you can’t have the same id property for 2 different elements. So I changed “Option 2 firstname id” to “c_firstname”.

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

Sidebar

Related Questions

Have done some research and found some stuff that may be helpful. I would
I have done some research, and majority of the examples I have found use
I have done some research and found that it's possible to have a progress
So I have done some research and found out that MongoDB doesn't do fsync(),
I have done some research and it really seems that implementing a transaction system
So I have done some research, and have found you can create a boost::thread
I have done some research prior to and have found some great articles but
I have done some research about Javascript sorting algorithms performance comparison, and found unexpected
I have done some research and still confused, This is my outcome of that
This should be quite easy, and I have done some research on this. I

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.