@@ -107,9 +107,9 @@ they'll be added seamlessly to the array of items. This is great in theory,
107
107
but takes a little bit more effort in practice to get the client-side JavaScript
108
108
correct.
109
109
110
- Following along with the previous example, suppose that you start with two
110
+ Following along the previous example, suppose you start with two
111
111
emails in the ``emails `` data array. In that case, two input fields will
112
- be rendered that will look something like this (depending on the name of
112
+ be rendered that will looking like this (depending on the name of
113
113
your form):
114
114
115
115
.. code-block :: html
@@ -124,19 +124,19 @@ and - via JavaScript - render another field with the name ``form[emails][2]``
124
124
To help make this easier, setting the `prototype `_ option to ``true `` allows
125
125
you to render a "template" field, which you can then use in your JavaScript
126
126
to help you dynamically create these new fields. A rendered prototype field
127
- will look something like this:
127
+ will look like this:
128
128
129
129
.. code-block :: html
130
130
131
131
<input type =" email" id =" form_emails_$$name$$" name =" form[emails][$$name$$]" value =" " />
132
132
133
- By replacing replacing ``$$name$$ `` with some unique value (e.g. ``2 ``),
133
+ By replacing ``$$name$$ `` with some unique value (e.g. ``2 ``),
134
134
you can build and insert new HTML fields into your form.
135
135
136
136
Using jQuery, a simple example might look like this. If you're rendering
137
- your collection field all at once (e.g. ``form_row(form.emails) ``), then
137
+ your collection fields all at once (e.g. ``form_row(form.emails) ``), then
138
138
things are even easier because the ``data-prototype `` attribute is rendered
139
- automatically for your (with a slight difference - see note below) and all
139
+ automatically for you (with a slight difference - see note below) and all
140
140
you need is the JavaScript:
141
141
142
142
.. configuration-block ::
@@ -162,7 +162,7 @@ you need is the JavaScript:
162
162
</form>
163
163
164
164
<script type="text/javascript">
165
- // keep track of how many email fields ahve been rendered
165
+ // keep track of how many email fields have been rendered
166
166
var emailCount = '{{ form.emails | length }}';
167
167
168
168
jQuery(document).ready(function() {
0 commit comments