Answer from comments to original post:
Normally, click
bindings within a submit
binding should fire correctly, as shown in this example based on the posted code: http://jsfiddle.net/SeKkc/
If you have a rogue ko comment, or some other markup that changes the binding scope, perhaps in the section marked:
... (lots of data bound fields) ...
This may interfere with your two bindings to click: commit
and click: rollback
as it may not be able to find those bindings. In other words, the commit
function that you are attempting to bind to is accessible by the submit: commit
binding, but something inbetween causes it to become inaccessible for the click: commit
binding.
If the click
binding cannot find commit
and rollback
, then a click on those buttons will fallback to the submit
binding, which happens to be bound to commit
. This fallback behaviour is shown here, where clicking the buttons will fire the commit
function: http://jsfiddle.net/SeKkc/2/
This behaviour may also be caused by a binding to a property that does not exist on the model. The buttons are at the end of the page and are processed last. Preprocessing stops when the invalid binding is encountered; this is before the buttons are processed, so no click handler is bound to them. This is why moving them to the start of the body caused them to start working.