This tutorial will create public survey pages to gather survey data. A public page means users can use the page without signing in.

We will create a super simple survey model with two fields - name and date.

And our response model has survey_id field and response to questions about global warming.

We're keeping things simple because this tutorial focuses on URL generation. All the other details are specific to user needs.

Let's create a page where we'll collect survey responses. We'll generate this page's URL to share with users. On this page, we'll add a free form component.

After creating this form, connect it to the survey response model.

Okay, we have our response form now. There is still work to do on this form but let's create a survey table first. We'll get back to this.

Now, let's add the URL column to the table.

This column does not have a corresponding field in the model. It doesn't need one. Let's configure this column to generate the URL.

Click on the URL column and toggle format text. Then, write this in format text input.{survey_id}

That's the survey response page's link:

We added {survey_id} at the end as a page parameter. This is where the actual "URL generation" happens. It gets the survey_id value from our survey model. We'll use that id on the response page.

Let's create some survey records and see the result.

Now, let's get back to the response page and use the survey_id in the link. We'll get the survey_id from the link and set form field value.

Click on the survey response form and add this event.

Here we're using javascript to extract survey_id from the link and set it to survey_id form field's value. The JS code:

function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
return getParameterByName('survey_id');

That's it!

Did this answer your question?