Reputation: 259
I have a template index.html which contains a table of data. At the end of each row data, there is an edit button which allows you to edit the column entries in that row.
Here is how my table is constructed in index.html:
<table style="width:300px">
<tr>
<td> Mailing List Name</td>
<td> Mailing List Creation Date</td>
</tr>
{% for listEntry in lists %}
<tr>
<td>{{ listEntry.name }}</td>
<td>{{ listEntry.create_date }}</td>
<td>
<form action="/list_edit" method="post">
<input id="submit" type="submit" value="Edit" />
**Extra hidden input fields would be added here**
</form>
</td>
</tr>
{%endfor%}
</table>
How can I pass variables defined in the ListEntry
model as hidden input fields to a form?
Upvotes: 0
Views: 1725
Reputation: 83788
Try:
<input name="{{ listEntry.someId }}" type="hidden" value="{{ listEntry.value }}" />
However if you have one <form>
element per row, you need to give submit
action a value based on which row it is too.
Upvotes: 1