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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:20:02+00:00 2026-06-15T13:20:02+00:00

Jsfiddle is here Please follow steps below in fiddle: Click on the Open Grid

  • 0

Jsfiddle is here

Please follow steps below in fiddle:

  • Click on the “Open Grid” and select either the “Yes or No” or “True or False” option, you will see the relevant answer buttons appear underneath.

  • Now if you look at the “Number of Answers” row it displays a string stating that “Only 1 Answer” can be chosen.

  • Click on an answer button to turn it on and then click it again to
    turn it off so that no answer button is highlighted green.

  • Click on the “Add Question” button, you realize that it has appended the control from the top into a table. No alert appears stating that you have selected less answers as that you have not highlighted one answer.

So the problem is that if you click on one of the answers “True or False” OR “Yes or No” to turn it on and then click on the same answer button again to turn it off, then when you click on the “Add Question” button, it does not perform the validation.

The reason I am assuming it is doing this is because when you click on a answer button for “True”, “False”, “Yes” or “No”, the hidden number of answers text input displays the number 1 as 1 answer is turned on (like the letter buttons), but then when you turn the button off, it displays 0 in the hidden text input as no answers are turned on.

What should happen is that as it is only one answer, if that string appears then the hidden text input should always display 1, no matter if there is no answer button is turned on as the user has to choose one answer. I think I have found out that the code below has caused the problem.

function updateAnswer(context, iQuestionIndex, bDisableAppend) {
    var _sCurrQ_Class = 'q_' + iQuestionIndex;
    var _oCurrAnswerContainer = jQuery('#answer_selections .' + _sCurrQ_Class);
    if (!_oCurrAnswerContainer.length) {
        _oCurrAnswerContainer = jQuery(document.createElement('div')).addClass(_sCurrQ_Class);
        !bDisableAppend && jQuery('#answer_selections').append(_oCurrAnswerContainer);
    }

    _oCurrAnswerContainer.html('');

    var value, id;
    // loop through all buttons with 'on' status and their info to the current answer container
    $('.answerBtnsOn', context).each(function (i, btn) {

        var $btn = $(btn);
        value = btn.value;
        id = $btn.attr('id');

        var n = $("input[name='value[" + id + "]']").length;
        var hid = "hidden" + id + n + "value";
        $(btn).attr("data-hid", hid);


        if (!bDisableAppend) {
            // append those values to the form
            var input = '<input type="checkbox" id="' + hid + '" name="value[' + iQuestionIndex + '][]" value="' + value + '" checked /><label for="' + hid + '">' + value + '</label>';
            _oCurrAnswerContainer.append(input);
        }
    });
}

My question is that in the jsfiddle, can anybody be able to get the fiddle working so that it will display the alert for when the user has not selected an answer after turning on and turning off answer button for “True or False” or “Yes or No”?

  • 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-15T13:20:04+00:00Added an answer on June 15, 2026 at 1:20 pm

    I think I’ve fixed it here, although your code is really messy. I added a conditional check to see if the number of selected answers is zero where it should be one – if so, just set the number that is set as value for .answerstxt to one.

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

Sidebar

Related Questions

I have a jsfiddle here: http://jsfiddle.net/ybZvv/61/ Please follow steps in fiddle: When you open
Please follow these steps in the jsfiddle to understand my question Click on open
Please refer the fiddle http://jsfiddle.net/HCqsM/5/ Here By clicking the 'click' link for the first
I have a test application here which you can use: Please follow steps below
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
Please find the code at http://jsfiddle.net/wlogeshwaran/NGL8P/4/ Here i want to make the 'hi' ,
I have a jsfiddle here . What happens is that if you select a
JSfiddle: http://jsfiddle.net/ybZvv/57/ I have a fiddle here where the user can append row and
This question is related to this question yesterday . Please see current jsfiddle here

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.