Help

Re: Is there any way to prefill a form with the current date?

4714 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Andy_Brice
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a ‘Date’ field. 99% of the time it is the current date. It seems that I can’t set a default value to appear in the form field (which seems like a major omission). Can I use the form prefill to do this? I tried this:

https://airtable.com/1234?prefill_Date=TODAY()

and

https://airtable.com/1234?prefill_Date=TODAY

But it didn’t understand “TODAY” or “TODAY()”.

10 Replies 10
Andy_Brice
5 - Automation Enthusiast
5 - Automation Enthusiast

Surely there must be some way I can default a date field to the current date in a form?

@Andy_Brice

I ran into the same problem today and found your post. I was able to work around my issue in the source-code for my web app, where I have my form links embedded.

If you have access to the source-code, you may be able to get around this in a similar fashion.

My app is a Ruby on Rails app, so in the controller for the page I have my links embedded in, I just made an instance variable @today = DateTime.now which will be available to that view.

Then in the view, I interpolated that variable into the link URL like so:
<a href="...airtable.com/12345?prefill_Date=<%= @today %>"></a>

This worked for me - notice the URL and the pre-filled Date field:
image.png

I’m afraid I can’t be of much help for frameworks other than Ruby on Rails, but hopefully this points you in the right direction :winking_face:

Ian_Nicholson1
4 - Data Explorer
4 - Data Explorer

As of today (5/25/2018), https://airtable.com/1234?prefill_Date=TODAY worked! That will be a big help on my forms!

Thanks Jeremy. In the end I did something similar with Javascript.

Are you sure this works? I couldn’t get it to prefill for me. If so, can you share an example? Or perhaps how you’ve set up your date field maybe?

Tim_Roth
6 - Interface Innovator
6 - Interface Innovator

I got around this by creating a prefill form condition called “now” that triggers zapier to update the date/time field to the time the record was submitted.

Simon_Wade
4 - Data Explorer
4 - Data Explorer

It would be good to have a way to do this.

Eric_Petersen
7 - App Architect
7 - App Architect

I have not succeeded using prefill_ on a form for a date field.
Here is what I am doing:
-Input Date field for data entry within AirTable.
-Form Date field for data entry with Forms.
-CreateDate = Created time field type
-Date =
IF({Input Date},{Input Date},IF({Form Date},{Form Date},{Create Date}))

It’s important to note that the tip from @Jeremy_Oglesby above works in Ruby on Rails. If you’re trying to use his syntax directly in a URL to an Airtable form, it won’t work.

The details you list tell part of the story of how your fields operate, but what’s not clear (to me, at least) is more of the logic behind their operation. The detail of the {Date} field formula partly covers this, but part of it admittedly still confuses me, namely the inclusion of the {Create Date} field. {Input Date} appears to be the preference when someone is directly entering data into Airtable. If that’s not there, it falls back to {Form Date}, which is (guessing) a date that the user manually enters into a form (which might also be the one that you’re trying to auto-fill…maybe?). If that date is missing, the final fallback is {Create Date}, which will be there no matter what when the record is created.

Because you will always have a date in {Create Date}, I’m not sure that I understand the logic of including the other date fields at all. When the user does manual entry in Airtable, you’ll have that date. When the form is filled out, you’ll also have that date. It feels like {Input Date} and {Form Date} are unnecessary. Am I missing something?