Help

Extension for getting URL into embedded Airtable form?

Topic Labels: Extensions
2068 8
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Streever
4 - Data Explorer
4 - Data Explorer

Hi! I’m trying to figure out how to ‘get’ the url of the page my form is on.
I’m deploying an embedded airtable form into hundreds of articles (We run a news site). I can not manually put the url in.
Most forms will tell you ‘where’ a user filled it out… is there an easy extension/way to get the url and submit it into a ‘single select’ or short text field?

8 Replies 8

That is not possible with Airtable’s embedded forms. You would need to use JotForm’s embedded forms to do that. Check out this support article on JotForm’s site:

Hmm, if you’ve got some web dev resources this could be relatively easy depending on how your site’s set up

You can prefill embedded forms, so you could potentially create a new field called “Source” or something, add it to your form and hide it, and then dynamically prefill it with the URL of the page it’s loading on?

Hey Adam, this is a good point actually; I’m wondering if I can just make a simple HTML form and connect it to Airtable, skipping the Airtable form entirely? I have to look into the Airtable API a little more closely.

What Adam is suggesting is much easier than creating a new HTML form that you would need to hook into the Airtable API. You also don’t want to be calling the Airtable API from a webpage as that would expose your API Key.

Instead, create a new field in your form to hold the name of the parent webpage. Then use query parameters for the url of the shared form to fill in that field and hide it. Each time you embed the form somewhere, change the query parameter to show where it is embedded. Thus you have only one form, but when people submit it, you see the webpage that you included in the query parameters.

https://support.airtable.com/docs/prefilling-a-form

@kuovonne explained it much clearer than I could!

Thank you for this!
Basically, you and he are suggesting I can just use my jQuery code to get the url & put it in the embedded form, so I don’t have to recode my own form in HTML?

Yeap, you hit the nail on the head!

Sadly, I've hit another snag! the form input IDs are dynamically generated it seems so I can't use my javascript, which targets the element by an ID.

var urlField = document.getElementById("WHAT GOES HERE?").value;
var aflinkfill = document.URL;
urlField.value = aflinkfill;