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

  • Home
  • SEARCH
  • 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 8248615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:14:50+00:00 2026-06-07T23:14:50+00:00

I have a form (a dynamically created questionnaire) with multiple questions. I have used

  • 0

I have a form (a dynamically created questionnaire) with multiple questions. I have used jQuery to style the radios as buttons (http://jqueryui.com/demos/button/#radio) but I’ve cut down the code slightly here…

<div class="yesnoradios">
    <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_Y" value="Y" />Yes
    <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_N" value="N" />No
    <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_NA" value="NA" />N/A
</div>

So, I have multiple instances of the above, with dynamically named id‘s.

I’m struggling to client-side validate the form on submit. What I need to do is ensure that one answer is selected for each question. I don’t have a lot of experience of jQuery so all I’ve done so far is loop around each question.

$('.yesnoradios').each(function(index) {
    alert($(this).attr("id"));
});

I thought I’d mention, when viewing the page in English, it’s using select‘s instead of radio button which I’m able to validate fine, but the reason I can’t use that in this instance is that the user is viewing the page in a language where the equivalent of ‘Yes’ or ‘No’ is different depending on how you structure the question, so I’m using ticks and crosses.

Thanks in advance for any help.

Edit: What I’ve tried to do is use the .children() function to check if one is checked and if not set a flag that says the form is invalid. But I cannot get the syntax right, and haven’t been able to find a good code sample for this yet.

  • 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-07T23:14:52+00:00Added an answer on June 7, 2026 at 11:14 pm

    Assuming you have a lot of the below …

    <div class="yesnoradios">
        <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_Y" value="Y" />Yes
        <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_N" value="N" />No
        <input type="radio" name="section<%= section %>_question<%= question %>" id="section<%= section %>_question<%= question %>_NA" value="NA" />N/A
    </div>
    

    you can use this to see if at least one of all the groups is selected by using the following code

    $('.yesnoradios input[type=radio]:checked').length
    

    This will give you the exact no of groups which have been checked. Check it with the no of class="yesnoradios" and if you have the same no then at least one of the radios in each yesnoradio div have been checked

    if($('.yesnoradios').length == $('.yesnoradios input[type=radio]:checked').length){
        //all groups have at least one radio checked
    }else{
        //not all are chedked and you can loop your else logic here
    }
    

    Note: All your radios in one group should have same name… and since you have posted unrendered html here i’d assume that it does so.

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

Sidebar

Related Questions

I have a form with multiple textboxes which are created dynamically, now all these
I have a form dynamically created using Jquery and i am trying to validate
I have a form that is dynamically created, on this form are several radio
Fact: I'm not that good with jQuery. Problem: I have a form containing dynamically
I have several radio buttons that are dynamically populated on a form and I
I have created a form with a dynamically created field and i am trying
I have dynamically created a xml string form a JSON object returned from server.
I have: form.php preview.php form.php has a form in it with many dynamically created
I have a form that has an array of dynamically created labels of varying
I have a form with dynamically created input fields - upon submitting it 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.