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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:23:25+00:00 2026-05-26T22:23:25+00:00

I am using knockout with jquery template, I am stuck in a place in

  • 0

I am using knockout with jquery template, I am stuck in a place in my template. Let me show you the code first.
Here is my template

 <script type="text/x-jquery-tmpl" id="questionTemplate">
        <div class="questions">
               <div data-bind="text: QuestionText" style="font-weight:bold;"></div>
               {{if QuestionType == "FreeForm" }}
                       <textarea rows="3" cols="50" data-bind="value: ResponseValue"></textarea>
                   {{/if}}

                   {{if QuestionType != "FreeForm" }}
                       <table>
                        {{each(i,option) Options}}
                        <tr>
                       <td>
                       <input type="radio" data-bind="attr:{name:QuestionId},click:function(){ResponseValue=option.Value;}" />${option.Value}</td><td>- ${option.ResponsePercent} %</td> 
                       </tr>
                        {{/each}}
                       </table>    
                   {{/if}} 
            </div>
    </script>

And here is how I am using it

<div data-bind="template:{name:'questionTemplate',foreach:questionResponses()}">

So what basically it is doing is, it is looping for each question response and checks if question type is FreeForm then it creates a textarea else it picks questionResponse’s object array property “Options” and uses jquery {{each}} to show each option as a radio button.
And on submit I am picking the “ResponseValue” property’s value, if it is textarea then I get textarea value or else I get selected radio button’s value.
This all is working perfectly fine.

This is how it looks in UI

1. Tell me about yourself
[A Text Area Since it is a FreeForm Question]

2. How much you will rate yourself in MVC3?
RadioButton1
RadioButton2
RadioButton3

3. Blah Blah Blah?
RadioButton1
RadioButton2
RadioButton3
RadioButton4
RadioButton5
RadioButton6


... so.. on.. 

Currently I am assigning “QuestionId” as a name for radio buttons with the thinking to make them mutually exclusive within the question.
So here second question’s all the 3 radio buttons will have say name=”111-1111-1111″.
And third question’s all the 6 radio buttons will have say name=”222-2222-2222″
Note – QuestionId is of type Guid

The only and small issue stuck me is, it does not allow me to change my selection, I mean say if I select RadioButton1 for question 2 then it does not allow me to select RadioButton2 or 3, same goes for each question. This happens in firefox. While IE 9 doesn’t even allow to select any of radio button in the page.

Any help will be appreciable

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-26T22:23:25+00:00Added an answer on May 26, 2026 at 10:23 pm

    Your best bet is to use the checked binding with your radio buttons. Your binding would look something like:

    <input type="radio" data-bind="attr:{name:QuestionId, value: option.Value }, checked: $data.ResponseValue" />${option.Value}</td>
    
    • The name attribute makes sure that they are mutually exclusive
      within a question.
    • The value attribute determines what the
      checked binding will use for its value
    • The checked binding will
      set option.Value with the option’s value

    Here is a sample: http://jsfiddle.net/rniemeyer/ncERd/

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

Sidebar

Related Questions

I'm using Knockout with jQuery and jQuery templates. Assume that I have a template
I have: jquery1.6.min, jquery-tmpl.js (latest beta) and knockout-1.2.0.js. I am using a very simple
So far in the Knockout.js documentation, they only show using jQuery templates that are
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am using Knockout JS in combination with this combobox extension for jQuery: http://source.dellsala.com/jquery-combobox/demo/
We like using jQuery templates with SVG for example to show a Product with
I'm fetching JSON from my ASP .NET website using the following jQuery: $.ajax({ type:
Html form is controlled using Knockout JS and jQuery templates. Basic jQuery validation is
I'm using the options binding on a select list used in a jQuery template:
I am using knockout.js with jquery ui button. I built a custom binding on

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.