Almost any web application requires an HTML form for user input. In the previous chapters, we learned how to render a form manually and bind it to the view model.
However, we should look for backbone-forms extensions, which allow us to deal with forms more easily by writing less code. In this recipe and in further recipes, we are going to learn how to use this extension.
Let's create a simple form for BuyerModel
, which will look like the following screenshot:
To include backbone-forms into your project, download the entire extension archive from the GitHub page (https://github.com/powmedia/backbone-forms), and extract it into the lib/backbone-forms
directory. Then include a reference to the extension files into index.html
.
<link href="lib/backbone-forms/distribution/templates/default.css" rel="stylesheet" /> <script src="lib/backbone-forms/distribution/backbone-forms.min.js"></script>
Including the Backbone extension into your project is described...