1

I need to data bind the radio button to the value that comes from the database

html

 <input type="radio" name="dateRange" value="selectByDays" data-bind="checked: daysSelected">

I checked using the pre data-bind tag to see whether daysSelected is passed properly and it is. But the radiobox is still not being selected when daysSelected = true

Any ideas?

sarsnake
  • 26,667
  • 58
  • 180
  • 286

1 Answers1

1

The checked binding, when used with radio buttons, is designed to hold the value of the radio button selected - they would usually be in a group of radio buttons with different values all bound to the same observable. Since your radio button has a value of "selectByDays", that's what you need to set the value of the daysSelected observable to, rather than setting it to true.

James Thorpe
  • 31,411
  • 5
  • 72
  • 93