I have suggested a custom binding for something like this before, if you are not able to put the values in yourself. It would look something like:
//create an observable set to the current field's value. Rewrite data-bind to use real value binding
ko.bindingHandlers.valueWithInit = {
init: function(element, valueAccessor, allBindingsAccessor, context) {
var property = valueAccessor();
var value = $(element).val();
//create the observable, if it doesn't exist
if (!ko.isWriteableObservable(context[property])) {
context[property] = ko.observable();
}
context[property](value);
//rewrite data-bind to use real value binding (would need to be more robust, if attribute contains other bindings). Otherwise, we could certainly just call the value binding's init and update function with a new valueAccessor that returns the new observable.
$(element).attr("data-bind", "value: " + property );
ko.applyBindings(context, element);
}
};
So, the idea is that it creates an observable on your view model, if necessary, and then populates it with your value and then converts the field to just use the normal value binding.