Saw the URL structure for prefilling a form (airtable[dot]com/1234?prefill_Name=Jane for example), but I’m trying to prefill a form with today’s date in one of the date fields.
I tried ?prefill_Date=TODAY() and ?prefill_Date=Now() but appears after some experimentation that URL passes the text straight through rather than using the named formula.
Is there any way to get a date field on a form to pre-fill / default to today’s date??
If your link is generated by a formula within your base, you could achieve this like this:
"https://airtable.com/formviewidhere?prefill_Todays%20Date=" & TODAY()
Alternatively, you could use the Created Time field type if you’re just trying to track when a record was submitted. I don’t believe it shows up on the actual form, but you can see it in the grid view.
Unfortunately neither of those cases quite fit.
The date needs to be entered - 95% of time it will be today’s date, but the person submitting needs to be able to adjust it.
And I want the form link to be bookmarked by users …clicking the link should bring up the form with today’s date as default…
Any other thoughts?
Hmm… I can only really think of a few things, but none are perfect and two assume that you have some sort of website for your users; or just a landing page.
Rather than having them bookmark the link itself, you could have them bookmark a shared view with just the link to the form.
Or, if you do have a site to embed it on, you could embed that view with the link to click.
Lastly, similar to the post linked below, if you do have a website and can edit the source code, you may be able to embed it into the URL there.
Wish I could help more! If you do get it figured out, definitely let me know.
This was a while ago, but I thought I’d share my workaround.
My workaround was to have two/three different fields. On the form itself, I have a “Timestamp Override” that allows the date/time to be chosen manually. If left blank, no problem.
On the “backend” the database has a Timestamp field that first looks to see if the override field is filled in and uses that. If the override is left blank, it uses the CREATED_TIME() function and pulls the timestamp when the record was created.
<!DOCTYPE html> <html> <head> <title>Prefill today link</title> <script> var today = new Date(); var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0! var yyyy = today.getFullYear(); var today = dd + '/' + mm + '/' + yyyy; </script> </head> <body> <script> document.write('<a href="https://airtable.com/FormIDhere?prefill_Date=' + today + '">Link</a>'); </script> </body> </html>
Source for some of this gratefully acknowledged below:
Then, this will generate the date and then navigate the browser for you.