Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Prefill today's date in form

5343 9
cancel
Showing results for 
Search instead for 
Did you mean: 

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??

9 Replies 9

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.

Thanks!

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.

What I would do is 3 cells :

  1. Created date (automatic)
  2. Overrided date (date field that can be left blank if today’s date is alright)
  3. Date : function taht takes 2. if exists or create_date instead

So you can use the cell 3 for the definitive date

We’ve built a form that integrates with Airtable. One of its features is the ability to auto-fill today’s date when the user initially load the form.

Something I’ve cobbled together from other places. If you can lead your user to a HTML page and click a link, then that link can include the TODAY prefill snippet via JavaScript as follows:

<!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:

You can create a javascript bookmarklet. So when you click on it it will execute a bit of javascript. You create the bookmark like so:

Screenshot 2023-01-03 at 12.05.56 PM.png

With javascript, we can generate the current date and then navigate the browser. So for the bookmark URL, put in the following:

javascript&colon;(() => { window.location.href = `https://airtable.com/<FORMID>?prefill_Datetime=${encodeURIComponent(new Date().toLocaleString().replace(',', ''))}`; })();

Then, this will generate the date and then navigate the browser for you.

Crud, the forum is escaping some of the code snippet there. Replace "&colon;" with the actual colon ":" when creating your bookmark.