0

For my view; I have a simple textbox as below.

<input type="text" data-bind="value: vm().dummyValidationTest">

in the viewmodel, I have observable defined as

dummyValidationTest = ko.observable().extend({ required: true });

Finally, I apply binding as

 ko.applyBindingsWithValidation(vm);

This validation works great when textbox is on the main form; however as soon as I move textbox inside Bootstrap Modal defined as below validation does not work.

 <div class="modal" id="startNewApp-modal">

Any thoughts why validations won't work inside Modal Window?

Both base page and modal are defined in same View.

EDIT: Please see jsfiddle below example

  1. No modal, validation working: http://jsfiddle.net/athekdi/y53V2/

  2. With modal, validation not working: http://jsfiddle.net/athekdi/6W5xH/1/

4

1 回答 1

1

您需要validation library reference在 KO 之后移动,因为它取决于该库

http://jsfiddle.net/6W5xH/2/

于 2013-11-08T10:08:58.130 回答