Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • noe 4 posts 74 karma points
    Apr 13, 2016 @ 15:23
    noe
    0

    Saving data between steps in the form to complete form later

    Hi Everyone (Sorry for the long post),

    [Resume: Is it possible to access form data between steps? by triggering a workflow or something without submitting the form?]

    First of all apologies if I'm asking non-sense or I'm asking something that has already been solved (is the very first time I'm dealing with Umbraco in my life ^^' ), but after googling for quite a while now, I decided to create this topic.

    After a couple of hours searching I notice that "Umbraco Forms" is the new "Contour" and there isn't too much documentation about it.

    I'm trying to create a form with Umbraco forms which I did without any issues it's 3 pages form, 1 check box in each page pretty simple. And I want to save the process of this form, I saw there is something called "Workflows" and the only useful information I found was this one Dan's workflow class.

    After reading the documentation it looks like this workflows only runs when the form is submitted? I checked the .json config file for the custom workflow that I did and it's like this (App_Plugins/UmbracoForms/Data/workflows/{GUID}.json):

    {"id": "d02e6610-877a-4b07-9323-1852d2ce5efb",  "name": "Save progress of form to member property",  "form": "8f076afb-6c7a-444f-90b2-d93cdf91c575",  "active": true,  "workflowTypeId": "97c5796d-34da-451b-a5ec-9eeb9ae216cc",  "executesOn": "Submitted",  "settings": {},  "sortOrder": 1}
    

    After googling a bit I found those values can be: Submitted/Approved (only after form submission)

    I decided to start checking the DB and try to figure out how Umbraco handles the data in this forms. It goes from page to page of the same form refreshing the page so I thought maybe it uses the DB.

    Umbraco Forms Table Structure

    There we can find [UFRecords] all the submitted records go there, the problems is that before submitting the form all the data isn't in the DB either, so I can't write a custom piece of code to get this data and handle it manually.

    I don't know if I'm missing something or not as this stage, Umbraco documentation doesn't tell too much about this. So I'm not sure if this is possible or not.

    I show that in the following table [UFRecordFields] we keep a track of the Fields and the DataType and the Record they belong to, but this data is only created after the form is created (After submitting the form).

    Anyone knows if this is possible? or shall I go for a custom form entirely from scratch?

    StackOverflow Thread

  • Jinesh Kaneriya 22 posts 155 karma points
    Apr 14, 2016 @ 13:36
    Jinesh Kaneriya
    0

    Yes you can call controller with jquery so use single form and take three div and hide and show div with jquery's hide() and show() functions and put next button on this button you can hide and show div and you can call controller on button click event.

    For Example

    $("#next-stepbtn1").click(function () {
     $.get('/umbraco/surface/Account/CheckUserNameEmail', { userName: $('#userName').val(), email: $('#email').val() }, function (r) {
                if (r != "") {
                    $('#useremailError').html(r);
                    $('#wizardStep1').show();
                    $('#wizardStep2').hide();                   
                    $('#step1').addClass('current');
                    $('#step2').removeClass('current');                    
                }
                else {
                    $('#useremailError').html('');
                }
            });
    

    In CheckUserNameEmail controller method I wrote code that member is associated with site or not and it return empty string means user is not associated with site and next step will visible.

  • noe 4 posts 74 karma points
    Apr 14, 2016 @ 14:59
    noe
    0

    Hi Jinesh,

    If I'm not confuse the idea that you are suggesting would work if you have full control of your form and the HTML that it renders but as I'm using Umbraco Forms (New Contour) I don't have control over the divs the plug-in renders?

    I'll think a bit about a front end approach (Thanks for the idea!!)

    cheers :)

  • noe 4 posts 74 karma points
    Apr 18, 2016 @ 09:45
    noe
    0

    Hi guys,

    I think I have an idea to be able to do this after giving it a thought by including a layer on jQuery code we should be able to keep a track of all the steps and saving them in the DB against an existing user. But again this "patch" will only work based on a front end point of view, is there any solution using a MVC approach?

    If there isn't anyone able to explain an MVC approach I'll edit this post including my solution.

    Thanks guys!

Please Sign in or register to post replies

Write your reply to:

Draft