how to put data(id) in form (wtforms) and get it back on submit <p>I am new to wtforms, so I`ll really appreciate any help. </p> <p>I need to display books names and near each put "Delete" button. I`ve read <a href="http://wtforms.readthedocs.org/en/1.0.4/crash_course.html" rel="nofollow">wtforms crash course</a> but I have no idea how to solve my problem with it.</p> <p>So I decided to do it other way - my best idea is to render to template a dict with id and name and on submit return id, but I still can`t do it. Code examples are below.</p> <p>It`s view.py</p> <pre><code>@application.route('/delete', methods=['GET', 'POST']) def delete(): books_lib = mydatabase.get_all_books() form = DeleteForm(request.form) if request.method == 'POST': delete_id = form.id.data mydatabase.del_book(delete_id) return render_template('delete.html', form = form, books_lib = books_lib) return render_template('delete.html', form = form, books_lib = books_lib) </code></pre> <p>It`s template</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;h2&gt;book to delete&lt;/h2&gt; &lt;form action="/delete" name="delete" method="POST"&gt; {% if books_lib %} {% for id, book in books_lib.items() %} &lt;p&gt;{{book}}:&lt;input type="submit" value="Delete" id="{{id}}"&gt; {% endfor%} {% endif %} &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It`s form</p> <pre><code>class DeleteForm(Form): book = TextField("Book name", [validators.Length(min=2, max=25)]) id = HiddenField("id") </code></pre>