Re: [Cppcms-users] Multi-step forms
Brought to you by:
artyom-beilis
From: Jon F. <jon...@jf...> - 2020-10-16 21:02:43
|
Hey Joel! I confess I've not used the jQuery wizard stuff either. Besides Martin's suggestions I would make one more. I'd study the form widget classes and make appropriate subclasses to facilitate jQuery's wizard system. This would allow for reuse wherever needed. Also it might not be obvious but forms are allowed to be members of forms. This allows for being able to easily render sub sections of the form in a view and once all of the data has been accumulated you pass the whole set of data to the topmost parent for parsing the full form's content. Something along those lines might also be helpful. - Jon On 10/16/2020 05:59 AM, Martin Bürgmann wrote: > Hi Joel, > > while not having looked at the jquery stuff I have a suggestion. > The `cppcms::widgets` classes create the structure of the form and can > be used in two ways. > 1. Generate HTML from the structure > 2. Parse the POST data that would be generated by such a form being > submitted. > > Now if you make the POST data of the jquery form follow the structure > of your `cppcms::widgets` form, then you can simply parse the POST data > with said form. The HTML generation is then simply skipped. > > This would be a 50% workaround. Still have the manual created jquery > wizard but also have the automated cppcms parsing. > > Ok, now you got me invested :D > I briefly skimmed the link you sent. > > So the other 50% would possible by using the `<% form input ... %>` > tag[1]. > You could make your form in HTML but every time you would use an > `<input>` tag you just use `<% form input IDENTIFIER %>`. This will > need to be formatted correctly with CSS or you use `<% form begin ID > %>` and `<% form end ID %>` > > Sincerely, > Martin > > > [1]: > http://cppcms.com/wikipp/en/page/cppcms_1x_templates_comm#Rendering.Forms > > > > > > Am Freitag, den 16.10.2020, 11:01 +0200 schrieb jo...@em...: >> The forms example is very straight forward and easy to work with. >> However, I have to implement a step-by-step wizard using jQuery- >> SmartWizard[1]. >> As far as I can tell I cannot use the `cppcms::widgets` to create the >> form as I need some "custom" HTML as the form is split into multiple >> sections etc. >> At the end, there's some "Finish" button which triggers a Javascript >> function which will post the content of the form. I would then >> attempt to parse the POST request manually in the C++ code. >> >> Is this the recommended way of doing this? Or is there a way to >> customize the HTML code generated by the form widgets so that it >> structurally matches what I need for the smart wizard? >> >> >> [1] http://techlaboratory.net/jquery-smartwizard >> >> Best regards, >> ~ Joel >> >> >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Sent from my Debian Linux laptop Jon Foster JF Possibilities, Inc. jo...@jf... |