title: knockout change event on input: validation - set focus if invalid
body: <p>I have a table bound by knockout, with input fields in. I am successfully using the change event to validate one of the inputs, but I am struggling with this:</p>
  
  <p>how do I get knockout to set the focus back to the input if the input's data doesnt meet with my requirements?</p>
  
  <p>I've tried returning false to prevent bubble through, but this leaves focus on the next input in the tr.</p>
  
  <p>markup:</p>
  
  <pre><code>&lt;script&gt;
    $(document).ready(function() {
      mynamespace.myVm.myModel = new personalInfoViewModel();
  
      ko.applyBindings(mynamespace.myVmument.getElementById('divMyTable'));
    }
  &lt;/script&gt;
  &lt;div id='divMyTable'&gt;
    &lt;table&gt;
      &lt;tbody data-bind="foreach: mynamespace.myVm.myModel"&gt;
        &lt;tr data-bind="event: { change: $root.markDirtyRow }"&gt;
          &lt;td&gt;&lt;input data-bind="value: dto.PersonId,
                                event: { change: $root.validateId }"&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input data-bind="value: dto.someValue"&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>knockout:</p>
  
  <pre><code>var personInfoViewModel = function () {
    var self = this;
    var self.myModel = ko.observableArray();
  
    self.validateId = function (record) {
      if (doValidate(record.PersonId)) {  // for example
        self.UserData(record.PersonId);
        return true;
      } else {
        alert("Person Id " + record.PersonId + " is not recognised.");
        return false;
      }
    }
  }
  </code></pre>