Home:ALL Converter>How to implement a sequence of forms

How to implement a sequence of forms

Ask Time:2019-09-26T06:41:49         Author:user1933205

Json Formatter

New to Django here. I want to implement two forms in a sequence, where the second form depends on the saving of the first form. For example: View_A implements GET / POST methods of form A. Once Form A is submitted and saved, it will generate a unique ID. Form A also has a radio button with two choices (B and C). Depending on the choice made, I need to present the user with a second form B or a form C, where the unique ID from form A is filled automatically. The prerequisite for forms B and C is that the unique ID on form A is present. I can't use AJAX, because the form A needs to be saved first.

My problem is, as soon as I hit the submit button of form A, it becomes a POST request. I can generate the unique ID and display it in the returned html template. However, it's still the same view and I don't know how the display of next form. The display of form B/C should ideally be a GET request. But I am in the POST request.

I hope this is a clear enough question.

Thanks

Author:user1933205,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58107425/how-to-implement-a-sequence-of-forms
yy