Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here is my fiddle http://jsfiddle.net/9y8nm14m/[^]

I have loaded my viewmodel with the ko.mapping plugin and the load is working fine.When I try to post the content all the values are working fin except the value for the radiobutton the checked value is returning "on"[String] instead of true[bool].Am i missing something or Do i need to write compute for this.

I am loading the radiobutton with in the knockout foreach .
Posted

1 solution

Very interesting. This does not work this way.

If you see the official documentation - The "checked" binding[^], it says...
Quote:
For radio buttons, KO will set the element to be checked if and only if the parameter value equals the radio button node’s value attribute or the value specified by the checkedValue parameter. In the previous example, the radio button with value="almond" was checked only when the view model’s spamFlavor property was equal to "almond".

When the user changes which radio button is selected, KO will set your model property to equal the value of the selected radio button. In the preceding example, clicking on the radio button with value="cherry" would set viewModel.spamFlavor to be "cherry".

See the updated demo - [Demo] Knockout RadioButton Binding[^].
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900