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


#1

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()”.


#2

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


#3

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

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


#4

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


#5

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