KnockoutJS - Submit Binding
The form is not actually submitted to the server when submit binding is used. KO prevents browsers default action. If you want submit binding to work as real submit element, then return true from your handler function.
The binding function here will be the main function which needs to be invoked after submit event.
Let us take a look at the following example which demonstrates the use of submit binding.Live Demo
Let's carry out the following steps to see how the above code works −
Save the above code in submit-bind.htm file.
Open this HTML file in a browser.
This program adds 2 numbers. In KO, any accepted data from UI is considered in String format by default, so it needs to be converted to Number format in case of Numeric operation.
Please refer to click binding for additional notes such as passing extra parameters, etc. All notes on that page also apply to submit binding.