Form fields keep their content for later step pre-fill

Hi there,

I´m designing a tool for business representatives which enables them to collect customer data a bit easier and should enable them to turn these a bit later into leads.
In one part of the tool I´m having a form for the data collection. In other part of the tool there is a universal lead form (this form utilizes some of the data collected before). Both forms have to work separately but when the first form is filled - the second should contain some of the data - being pre-filled by the data collected beforehand.

I had an idea where I would use a condition - if the first form is filled then go to a special copy of the second form which is already set up and filled and I guess for the demo purpose it would be enough but I´m wondering whether there is some “smoother” way to do this…

Thanks in advance for your time…
Jan

Use global variables to store the data. When you enter the data into the first form, save each field to its own global variable. For example, if there’s a submit button, use the OnClick event of the submit button to set the value of each global variable to the value in each respective text field.

Then wherever your second form is, use it’s OnLoad event to set each field to the value of the global variables. If they’re empty, then the fields will just be empty. If the variables aren’t empty, then the value will be filled into the lead form.

Your submit button on the first form might look like:

OnClick
Set value of variable FirstName to: [[firstnamefield]]
Set value of variable LastName to: [[lastnamefield]]

In this case, in each Set Value action, you need to create local variables. So firstnamefield is the name of a local variable that is set to Text on widget and then select the correct text field widget.

Then on your second form:

OnLoad
Set text on widget 2ndFormFirstName to: [[FirstName]]
Set text on widget 2ndFormLastName to: [[LastName]]

You don’t need to create local variables here because you’re referencing the global variables.

1 Like

Many thanks - there is a catch however… my second form is on third state of a dynamic panel… I cannot find the interaction - tried the onPanelStateChange directly on the dynamic panel but it does not work…

You could even do it all directly from the submit button of the first form in this case and cut out the global variables altogether. Instead of setting the variables, just directly modify the text fields on the second form since if it’s all on the same page.

Otherwise it doesn’t matter that it’s in a dynamic panel. All widgets have an OnLoad event, you could do it on the text fields of the second form directly.

1 Like

So :wink: thanks to the console I can see that the variables are being created correctly on the page with the first form. So far so good…
But they remain only on the page and when I click on the button - the variables are not transferred… (on the next page the console shows 0000 but somehow remebers the names of the vars.) however when I get back to the previous page I can see them as stored and with next click of the button they DO tranfer to the next page where is all set up correctly, the form is populated correctly etc.

Could this be a bug in the 9beta?

It’s possible you might have missed a step. Here’s an example. On the Set Variable actions be sure to click the ‘fx’ button next to the value field to see the local variables in the dialog that pops up.

forms-example.rp (58.2 KB)

1 Like

forms-example_j.rp (104.0 KB)

Mate!! :wink: Or should I say Check-mate!

You were right about me missing one important thing - I was not creating the local variables… but at the end my whole suffering was caused by the order of the interactions that were happening on the page_1… I had the Open page interaction before the Variables ix… which is perfectly logical…

Outcome - i´m not that lost :wink: even though I´ve missed the very basic logic…

I tried to update your file with what is a bit closer to my actual case - so if you´ll be interested, have a look…

Thanks a million!
Jan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.