Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Storing data from multi-page form



  • Hi,
    I have a form that spans 2 pages (stackedwidget). The first page has a continue button and the 2nd page has a save button. I created a FormData class to store data submitted by user, after processing I save to database.

    How do I store the data from the forms (page 1 and 2) in FormData object before storing it in database?

    The only way I can thing of is making the FormData object global to be able to access it from both the continue and save buttons onclicked() but it's a bad design.


  • Lifetime Qt Champion

    Hi,

    Why not make each page responsible for returning you data ?-



  • Why not make each page responsible for returning you data ?-

    What do you mean by "returning"?

    Do I create 2 classes (FormDataPageOne, FormDataPageTwo), each responsible for its own page?


  • Lifetime Qt Champion

    Yes, take a look at QWizard and QWizardPage for inspiration


Log in to reply