Display User Input upon form submission

Hello everyone,

I’ve created an interactive form using a Multi-State box. Everything works perfectly fine, the form submits all entries into the database.

In the last “state”, I’d like to display a thank you message with the person’s name. (e.g. Thank you, John.) However, I cannot figure out a way to do that. Any help is appreciated, thanks.

You don’t give enough detailed informations, to be able to help you.

  1. You do not mentionhow exactly you seted-up your project.
  2. You also do not mention how and if your elements are connected by any dataset?
  3. Also you do not provide any code.

Since you do not provide any code, that means you are using DATASET + OPTIONS inside of the PROPERTY-PANEL.

  1. Also you did not mention which form exactly you did use…
    a) Wix-Form (an out of the Wix-Box-Element)?
    b) a Custom-Form ?

All these informations are important, and a real answer can’t be given, without all that INPUT.

No real INPUT —> no real OUTPUT!

Sorry about that, first post in here. Please see below.

This is a custom form that I created, not a Wix-Box-Element. The multi-state box has 9 states, some have single questions with either radio buttons or checkboxes, some have more than one input elements (e.g. contact info as text input boxes). At the end of the 9th page, the submit button submits all the info to a collection.

The collection is connected to two databases: one is a write only database, and the other is a read only database, called database1 and database2 consecutively.

I used a bunch of code to make the form, but most of it works. The part I believe does not work is pasted below. I literally got it straight from Wix’s own Youtube:


    //DISPLAY INPUT
    function getData(){
        let query = wixData.query('Custom Pouch Form dataset');

        return query.limit(1000).find().then(results => {
            console.log('getData', results);
            return results.items;
        });
    }
$w.onReady(()=> {
    $w("#dataset1").onAfterSave(()=> {
        getData().then((items)=> {
            $w("#repeater1").data = items;
        });
    });
});

Below is a screenshot of the state that I’m trying to modify. (The “Thank you” state)

Right now I have two issues:

  1. As you see, the message on top shows: “Thank you Elma”, which is the name of the person that submitted the form previously, and not the most recent person that filled out the form. I’m trying to find a way to display the name of the most recent person that hits the submit button.

  2. I’m also trying to show the inputs of the most recent user in the table you see below. The problem is that it is showing the inputs of every single submission there has been done. How can I create a table that only shows the input of the exact person that filled out the form?

I hope this has been clear enough. If there’s anything unclear, please let me know. Thanks!

Ok, you already are using → onAfterSave().

$w.onReady(()=>{
	$w("#dataset1").onAfterSave(()=>{
		getData().then((items)=>{
			$w("#repeater1").data=items;
		});
	});
});

Based on your → getData-function…

function getData(){
 let query=wixData.query('Custom Pouch Form dataset');
	return query.limit(1000)
	.find()
	.then(results=>{console.log('getData',results);
		return results.items;
	});
}

Sure that this is the right RETURN-POSITION ?

return query.limit(1000)

On the first look, it looks good, but i can not see the REFRESH…

Or you try to refresh your repeater, by code.

I am not working with datasets, but i assume the missing REFRESH could be your solution.

Thanks for the comment. Refresh did not exactly help, and I decided to not use “Thank you User”.

Right now I’m focused on the second issue where the repeater on the last page is displaying the whole dataset, whereas I want it to only display the very last entries of each input. Is there a way to do this?