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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:13:22+00:00 2026-05-11T19:13:22+00:00

I have an ASPX page where in the page load i am dynamically creating

  • 0

I have an ASPX page where in the page load i am dynamically creating some radio button list controls and rendering to browser.I will have 2 list items in each radio button list .One is Yes and second is No. The number of Radio buttonlist can be n.Now in my java script code, i want to know which radio button is clicked . I m already using jQuery .any easy way to handle this ?

My HTML rendered to browser is

<table border="0" id="tblQuestions">
    <tr>
        <td>Do you have a valid passport ?</td>
    </tr><tr>
        <td><table id="answer-1" border="0">
            <tr>
                <td><input id="answer-1_0" type="radio" name="answer-1" value="1" /><label for="answer-1_0">Yes</label></td>
            </tr><tr>
                <td><input id="answer-1_1" type="radio" name="answer-1" value="0" /><label for="answer-1_1">No</label></td>
            </tr>
        </table></td>
    </tr><tr>
        <td>Are you married ?</td>
    </tr><tr>
        <td><table id="answer-2" border="0">
            <tr>
                <td><input id="answer-2_0" type="radio" name="answer-2" value="1" /><label for="answer-2_0">Yes</label></td>
            </tr><tr>
                <td><input id="answer-2_1" type="radio" name="answer-2" value="0" /><label for="answer-2_1">No</label></td>
            </tr>
        </table></td>
    </tr>
</table>

Thanks in advance

  • 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-11T19:13:22+00:00Added an answer on May 11, 2026 at 7:13 pm

    The following code doesn’t specifically answer your question, but it might help. I’d modify it for you, but I just don’t have the time right now.

    I use this on exams, to warn the user that a particular question doesn’t have a selected answer.

    The questions are generated dynamically using a Server control which emits plain xhtml. I name all options with the same name, (Q1, Q2…), and ID them like (Q1a, Q1b …)

    To modify it for your purposes, perhaps you could build a list of selected options in the j loop, that is, adding name -value pairs where the “break” statement is.

    // Grabs all inputs - radio, checkbox, text, buttons and lists -sticks them in an array
    allInputs = document.getElementsByTagName("input");
    var last = "NameUnlikelyToBeUsedAsAnElementName";
    
    // walk through the array
    for (i = 0; i< allInputs.length; i++)
    {
        var input = allInputs[i];
        if (input.name == last) continue; // if this object name is the same as the last checked radio, go to next iteration
    
    
        // checks to see if any  one of  similarly named radiobuttons is checked 
        else if (input.type == "radio" )
        {    
            last = input.name;  
            var radios = document.getElementsByName(input.name);
            var radioSelected=false;
    
             //iterate over question options
            for (j=0; j < radios.length; j++)
            {
                if(radios[j].checked)
                {
                   radioSelected=true;
                   break; // Found it, proceed to next question 
                }
            }
            if (!radioSelected) // no option selected
            {       // warn user, focus question
                alert("You did not answer question " + input.id.substring(0,input.id.length-1));
                input.focus();
                return false;
            }                   
        }
    
    }
    
    return true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's worth knowing that OutOfMemoryException doesn't always really mean it's… May 12, 2026 at 12:02 am
  • Editorial Team
    Editorial Team added an answer The manual page for glGenTextures says see also glIsTexture; the… May 12, 2026 at 12:02 am
  • Editorial Team
    Editorial Team added an answer According to the Oracle JDBC Developers Guide - 14.6 Working… May 12, 2026 at 12:02 am

Related Questions

I have an aspx page defined as follows: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script
I have an ASP.NET page where i will check whether the user has logged
I have an aspx page (page1.aspx) where I set a Session variable and then
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.