Validation with inputs hidden by knockout

Validation with inputs hidden by knockout

Hi all,

I can't figure out how to get the validation plugin to work at all with radio buttons that live inside a "ko if" conditional block.
The radio buttons need dynamic names (to work as groups), which I assign through their data-bind attribute; the name however doesn't get assigned if the "ko if" is false, and jquery validation complains.
I have tried all combinations I could think of, suggestions would be really appreciated.

Thanks!

The html looks roughly like this:

  1. <form>
  2. <!-- ko foreach: myList -->
  3.      <!-- ko if: myTest -->
  4.          <input type="radio"
  5.             data-rule-required="true"
  6.             data-bind="attr: { name: 'isLead-' + id }, checked: isLead, checkedValue: 1"
  7.       />Lead
  8.      ... other similar radio ...
  9.      <!-- /ko -->
  10. <!-- /ko -->
  11. </form>