DrupalGap icon indicating copy to clipboard operation
DrupalGap copied to clipboard

Multi Page Forms

Open signalpoint opened this issue 8 years ago • 4 comments

Oh wouldn't it be nice, if we could have multi page forms?

signalpoint avatar Jun 11 '17 12:06 signalpoint

What's the strategy you have in mind? Saving each page data to local storage?

mkinnan avatar Jun 11 '17 12:06 mkinnan

@mkinnan We won't use local storage because we'll assume the submitted data is sensitive and shouldn't be laying around in local storage. The developer will still have the choice in their build/validation/submission handlers if they'd like to toss anything in local storage.

Instead we'll just use the DOM and friends to store and share the form state(s) as it passes through each page. FYI, this is for DG8 (which works with D7, and I'm still primarily D7 site based). I personally won't be back-porting this to DG7, and will encourage all DG7 users to migrate to DG8 (even though they still have a Drupal 7 site). Fun times ahead...

signalpoint avatar Jun 12 '17 02:06 signalpoint

FYI, this branch is super unstable at the moment with any pages the don't have a Form on them, derp...

dg.Form.prototype.getForm = function() {
};

This function is getting called infinitely on it seems all non-multi page forms, and any page without a multi form, yuck.

signalpoint avatar Jun 14 '17 03:06 signalpoint

/**
 * @TODO the fact that you're using "self" all over the place is sketchy, and I believe instead we should be using
 * .call() and/or .apply() to properly set "this" instead of getting/settings "self" all over the place.
 */

I'm calling myself out on this, the use of "self" is sloppy and would most likely need to be fixed in src/forms to use call/apply before going much further on this issue. Otherwise compare this branch src/forms and the default dg8 branch src/forms folder to dig into the madness.

signalpoint avatar Jun 14 '17 04:06 signalpoint