Auto fill current date and time

Hello,

I am looking for a way to enter the current time in a (duration) field in the web forum form by a single click or pre-filled (so it can be at least easy edited), as well as the current date for a date field. However, I can’t find a way to make javascript executable in the form.

I need this because I want to log phone calls and there I also need the start and end time of a phone call.

Thank you.

Welcome to the Airtable community!

You prefill an Airtable form by using url parameters, not with JavaScript.

If you open the form from a button field in Airtable, you can set the formula for the button to prefill fields with the values from the functions NOW() and TODAY(). You will probably need to fiddle with nesting these functions inside DATETIME_FORMAT in order to get the exact results you want.

If you want help creating the formula for the prefilled forms, you can us this app.

Since I only want to use the form to add new entries, how can I add this button to the form? Its not listed in the fields list.

@M_F You can’t automatically add the current date or time onto an Airtable form on behalf of the person filling out the form, but the person can just click on the “TODAY” button that shows up in a date/time field, and it will automatically fill in today’s date & time.

Alternatively: As soon as the form is submitted into Airtable, Airtable can give you the creation date & creation time of the newly-created record. You can do this by adding a “Created Time” field type in your table.

Otherwise, if you need the current date & time to actually appear on your form without any interaction from your users, then you would need to use an advanced form building tool like JotForm.

1 Like

The hotkey in Airtable to fill a date field with the current date and time also works in Airtable forms. On the Mac it’s ⌘ + ; (Command + semicolon). My hunch is that Windows users will use the Ctrl modifier instead of the Command modifier. Check Airtable’s hotkey popup (top-right of the UI: Help → Keyboard shortcuts).

Pop into the start time field when you begin a call and hit that hotkey combo. When the call ends, do the same in the end time field, then submit the form.

1 Like

Wow, that’s a good one! I didn’t know about that keyboard shortcut!

Sounds good, but this hotkey doesn’t work on a German keyboard because the semicolon requires a shift key and I suspect that’s why the hotkey interpreter recognizes it as another hotkey which isn’t set.

Ah, good point. In that case, perhaps consider a tool like Typinator, where you can make your own shortcodes that expand into whatever you want. It should be easy to make one that outputs the current date and time in the format required by the field.

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.