Multi-page form

How to create a form that spans multiple pages? I would like to ask a large number of questions, and based on the answers from previous questions, new specific questions will be asked.

+3
source share
4 answers

Traditional method: save all previous answers to questions in <input type="hidden">the following pages, so that the last form contains the entire application (but not all visible). Disadvantage: file downloads are annoying to remember, the amount of data can become large.

The usual method: throw answers - so far into the session or cookies when you go ahead by selecting them at the end. Disadvantage: parallel operations result in unpredictable conflicting results. Downloading files is still annoying. I would not use cookie / session storage solutions.

The modern method: to have a simple (long) single form, but use JavaScript to display only part of it at once. When you click Next, you simply hide the previous page value and display the next. The last button is a real submit button.

+5
source

There are several ways to do this:

  • Incrementally fill the database, send via submit
  • , (<input type='hidden' ...>) , ( @Trufa )
  • , ( )
  • cookie (, , ).

-, HTML5. , Microsoft.

+1

, , : / .

- , (, ), , .

0

, , , , , , , .

PHP - . , , , .

, , , , . .

0

Source: https://habr.com/ru/post/1769914/


All Articles