0

I am developing a django/html application where I have a table of data. I have to make a way for my users to delete multiple rows in a table. Therefore, I have decided to add checkboxes in a list.

I know that I can include it as

<tr>
<td><input type="radio" name="item1" /></td>
<td>Item1</td>
</tr>
<tr>
<td><input type="radio" name="item2" /></td>
<td>Item2</td>
</tr>

for each item. Then in the end, I can add:

<input type="submit" name="delete" value="Delete Items" />

But this will mean that I will have to enclose my list within a <form></form> Is this an ethical way of doing it?

I want to add this feature to my site but I also want to do it in the most professional way. Can anyone tell me if I am going in the right direction?

1
  • Ajax requests with post data. Commented Sep 27, 2016 at 14:26

1 Answer 1

1

Since you use Django, one way would be to take advantage of what Django provides for forms. Here are the examples from the official doc, for version 1.10:

-for the radio buttons: https://docs.djangoproject.com/en/1.10/ref/forms/widgets/#widgets-inheriting-from-the-select-widget

-for the form: https://docs.djangoproject.com/en/1.10/topics/forms/#building-a-form-in-django

A django form uses the form tag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.