Hello my friends, how are u doing ?
Well, I have some issue and as I ain’t a developer, i need help.
I’m trying to code a “multistage form”, but not into a slideshow, but as two pages form. The first one wants to get the basic data from the user/lead, for the lead generation, as complete name, personal ID, mobile and email. The second one is the complete form, to this user fill and finally send to us with the complete information. I created a database called FormCP. I put this database in both pages.
Well, when the user one fills the first one page form will click the submit button (“Save & Continue”) has to go to the second page, the complete form page. Into this second page I pretend to say hello with the user name collected in the first page, get the basic information already filled to respective fields and he will fill the another one fields at the form. As done this, he will click the submit button again to send us the complete information as a new generated lead (that I will send by the Sendgrid.js).
The problem is in between the first form page and the second complete form page, there’s no getting the information from the first one to the second one. I think there’s a solution to this, but I don’t know how.
May I mean to you all about the issue ?
My website is www.vista.com.vc and we’re a startup financial company in Brazil.
Appreciate if anybody can answer briefly!
Thank you so much!
Marcelo
Hello @givemeawhisky ! Whisky is good, Macallan is better !
Hope I’m not annoying you, but can u please advise me how to do that ?
What kind of storage ? Do I have to put into the both pages ?
Ask you for patience, because I’m really stupid on code.
Thank’ya
You are best using the session part of the storage.
https://www.wix.com/corvid/reference/wix-storage.html
If you click on the above API link, you can read all about it, plus scroll down to the FAO heading and you will get questions about passing data to each page and using setItem and getItem etc.
To see how to use code to add to each page, then just follow the examples here:
https://www.wix.com/corvid/reference/wix-storage.html#session
Something like this for example, although depending on what you are getting, then you might need to use .value instead of .text.
// Page Code 1
import wixLocation from "wix-location";
import {session} from 'wix-storage';
$w.onReady( () {
export function Submit_click(event, $w) {
session.setItem('title', $w('#title').text);
session.setItem('price', $w('#price').text);
session.setItem('class', $w('#class').text);
session.setItem('days', $w('#days').text);
wixLocation.to("/page2");
}
// Page Code 2
import {session} from 'wix-storage';
$w.onReady(function () {
const title2 = session.getItem('title');
const price2 = session.getItem('price');
const class2 = session.getItem('class');
const days2 = session.getItem('days');
$w('#title2').text = title2;
$w('#price2').text = price2;
$w('#class2').text = class2;
$w('#days2').text = days2;
});
More info about the Text and TextInput elements and how you can interact with them via code can be found here:
import {session} from 'wix-storage';
...
const price1 = session.getItem('price1');
$w('#pricetxt').text = price1; // if the element is Text
$w('#pricetxt').value = price1; // if the element is TextInput
Dear @givemeawhisky, thank you so much so far !
I will try to do each step you advise me and will let you know if I did or not.
Thank’ya !