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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:25:20+00:00 2026-06-13T10:25:20+00:00

Trying to perform a simple form validation pre-submit for UX enhancement purposes only. Problem

  • 0

Trying to perform a simple form validation pre-submit for UX enhancement purposes only. Problem that I am having is that .val() is only returning the first form field value and ignoring the rest.

jQuery

        $('#pForm').submit(function(){
            var print = $(".option:checked").val();
            var design = $(".option:checked").val();
            var error = "Please select a design service...";

            if(print == 'p10','p20','p30','p40','p90','p00'
            && design == 'd10','d20','d30','d40','d00') {

               alert(print);
               alert(design);

               return true;

            } else {

               alert(error);
               return false;

            }

        });

HTML (example code)

Each radio is labeled as follows:

<label><input type="radio" name="design" class="option" data-number="<?php echo $var ?>" value="d40"/></label>
<label><input type="radio" name="design" class="option" data-number="<?php echo $var ?>" value="d30"/></label>
<label><input type="radio" name="design" class="option" data-number="<?php echo $var ?>" value="d20"/></label>

<label><input type="radio" name="print" class="option" data-number="<?php echo $var ?>" value="p40"/></label>
<label><input type="radio" name="print" class="option" data-number="<?php echo $var ?>" value="p30"/></label>
<label><input type="radio" name="print" class="option" data-number="<?php echo $var ?>" value="p20"/></label>

End result is that I do not want the form to submit unless a value is choose from the print radio fields && the design radio fields. If the check fails I want to display an error message to the user.

*Some of the code above may be semi-pseudo Thanks for the help! 🙂

  • 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-13T10:25:21+00:00Added an answer on June 13, 2026 at 10:25 am

    OK, now that it’s more clear what you’re trying to do, then just do this to make sure that there is an item checked in each group:

    if (!$(".design:checked").length || !$(".print:checked").length) {
       // something is not selected
    }
    

    Once you ensure that there is a selected value in both, then you can get the value of the first item that is checked with this code:

     var print = $(".print:checked").val();
     var design = $(".design:checked").val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to perform a very simple task here. I have an <ol> that contains
I'm trying to create a windows form application that manipulates data from several tables
im trying to perform a simple database insert from a submission on a SilverLight
I am trying to perform a simple task in SQL Server and receiving an
I am trying to perform a simple URLRewriting. if you visit azamsharp.com it will
I'm a newbie to WCF, trying to perform relatively simple task. I'm trying to
I am trying to use an HQL to perform a simple update in hibernate,
I'm trying to use mechanize to perform a simple search on my college's class
I am trying to perform an ajax call inside a form (a Drupal node
I'm trying to perform a simple animation using Cocoa. One button causes an image

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.