How to get the dropdown values to the next page using Django

I have two dropdowns and a button on HTML form.The values in the second dropdown are dynamically updated using js based on the value selected in first dropdown.When I select the values and click on button,it navigates to a different page which also displays the same elements with additional information.How to send these values to the navigated page and set it to the previously selected values?

You would want your submit button to submit those values as parameters - either as part of the URL, or as form data, or even possibly as JSON.

Your view would then accept that data, and use that to specify the initial values in your second page.

I am new to Django and still learning it.Could you give me a programmatic example?

I’m interpreting the first part of your post as being something you’ve already handled (setting the second dropdown based on the selection of the first.) Your button then is the submit button for that form.

Submitting that form is going to call a view - the view then rebuilds the form populated with the post data. You can then use that data from the form to set your defaults and to build the form for the second view.

I don’t have any code to share for that specific situation. If you post your forms, models, views, and templates that you have so far, I can help point you in the right direction for your situation.

Ken