Knockout-Validation lib – clean patterns

Knockout-Validation on GitHub which also leverages the jQueryValidation lib All Bootstrap v3 compatible Coolest architectural nugget = applying validation rules to VM observables (not inside HTML markup) one clear reason why that is a better way -> when the VM field is bound to multiple UI points, you only define the rule once vs many var myVM = function() { var self = {}; // simple required self.orderId = ko.

Knockout, Validation, Bootstrap skinned File Input

  Visual example: Highlights: Skinning the native html <input type=“file”> by setting it’s opacity=0 and positioning above a bootstrap skinned button… this way when you click the pretty button you’re really clicking on the invisible native button which launches the file open dialog as usual, cool! :) Bootstrap input-group aesthetically bundles the visual elements – file button, filename box, valiation message and clear button Knockout Custom Binding on the file input change event to save into VM observable Knockout-Validation lib to require selected file to be an image type – nice thing here is keeping that logic in the js ViewModel vs dirtying the html with it.