Unable to save dynamically populated html table data

I am relatively new in django and in this forum. In a project of mine using in django 5.1, I have designed a form where I am populating three dropdown list boxes (two of them are dependent or chained list boxes) with options coming from DB using HTMX.

After selecting desired options from the list boxes, the html table in this form (just below the list boxes) is being populated with the filtered data from DB based on three selection criteria (also done by HTMX). I have three columns (ID, Name and Check box) in this table and a Submit button at the end of the table. Everything is showing up (including filtered data along with a check box at the end of every row of the table) as expected.

I want to select items in the html table by clicking the check boxes and after hitting submit button, the IDs of selected items should be sent to a view method.

Clicking the submit button invoke the view method; but the problem is, the list containing IDs of selected items is empty. In the view, I am taking the list of selected items using following statement,

selected_ids = request.POST.getlist(‘item_id’)

Since the table-data are dynamically loaded, I am not seeing the source code for the html table rows containing my filtered data.

After searching the net, implementing (and re-implementing) the suggestions that I found on the net, didn’t solve my problem.

Question is how do I do this in django?

I will appreciate your response on my problem. Thanks in advance.

Welcome @ekramulf !

To us to try to diagnose an issue like this, we’re going to need to see the code involved. This means posting the views, forms, and JavaScript being used for this.

You might want to examine the data being posted using the browser’s developer tools to verify that what is being submitted is what the view is expecting.

You could also add print statements in the view to verify what it has received.

You should examine your page using the browser’s developer tools and not “view source”. That will always show you the current html being shown in the browser.

Side Note: When posting code, templates, error messages, or other preformatted text here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.
Please do not post screenshots of code or other text information.

Thanks for your quick response. I will get back here soon after I examine my code in the development tool of the browser.