I have an HTML page with a series of list items. I would like to be able to push a button, read the data in the list, and do a sort of transformation. I thought it would be rather like this example.
However, this format uses the name attribute to get the data and neither a list or list item can have names!
My HTML:
<form action="{% url 'index' %}" method="POST">
    {% csrf_token %}
    <ul id="myList">
        <li id="myId1">First Item</li>
        <li id="myId2">Second Item</li>
    </ul>
    <button type="submit">Submit</button>
</form>
My python:
def index(request):
if request.method == 'POST':
    var = request.POST['myList']
    print(var)
return render(request, "test.html", {})
Is there a way to get items in a list?
Additional Information:
- Current output is just None.
- I can grab data like text boxes just fine, those are named items.
- I have tried a few other suggestions, like var = request.POST.get('myList'), and even started dealing with forms and models but I could only grab data that was IN the model that way, not a<li>.