Mar 20, 2021 09:43 PM
A question arose recently that’s come up a few times in the past: is it possible to give form users the ability to either pick an item from a predefined list or add their own “other” option, and have manually-added options actually appear in the list for later form users? For most of Airtable’s existence so far, this wasn’t possible (at least not without delving into the API, and even then I’m not completely sure that was doable). However, it can be done using Airtable’s automation feature. Here are two methods you can use:
Most of the time this question comes up, the user is probably thinking of using a single select field. While this will work, it comes with a couple caveats that actually make the second method preferable IMO. That said, some of the details that I share here will also be used in the second method, so I still recommend reading through this one.
First, define your single select options as you wish, with an option named something like “Other” as the last entry.
Add a single line text field named something like “Other option”.
In your form setup, put this “Other option” field after your single select field, and make it conditional, only displaying when the user picks “Other” from the preceding list.
Create a new automation using the “When record matches conditions” trigger, with the condition being that {Other option}
is not empty. Add an “Update record” action, choosing the same record that triggered the automation, and setting the value of your single select field to the value added by the user in the {Other option}
field.
Turn on the automation, and it’s done. When a user picks “Other” from the single select field, the {Other Option}
field will become visible, allowing them to enter their own choice.
When the record saves, the automation will add that new item to the single select.
So what about those caveats?
That’s why I prefer…
The setup is similar to what’s above, but with a few changes.
Instead of creating a single select field, make a new table to contain your list options (I’ll call mine [Options]
for consistency), including an “Other” option. To ensure that “Other” remains at the bottom of the list, add an {Order}
formula field using this formula:
IF(Name = "Other", 9999, 0)
Then sort the view by this {Order}
field.
Next add an “Approved” checkbox field and check this box for all of your initial options. Change the view name to “Approved”, and add a filter to only show approved items.
Now the view should look something like this:
Duplicate this view and name the new view “Unapproved.” Modify the visible fields to only show the {Approved}
checkbox field. Change the filter to only show records where {Approved}
is not checked. For now, it’ll be an empty view, which is fine.
Back in your main table, add an “Options” field (or whatever name you wish to use) and make it a link to your new [Options]
table, only allowing individual records to be selected.
In the form setup, set {Options}
to only allow selection of records from the “Approved” view.
As with the first method, set the “Other option” field to be conditional, only appearing when {Options}
contains “Other”.
For the automation, begin with the same trigger as in the sample above. The first action in this setup, though, will be to create a new record to the [Options]
table, with the record’s primary field being the value entered by the user into “Other option”:
Now add an “Update record” action. In this case, add a link to the newly-created record into the {Options}
link field.
Save and activate the automation, and you’re all set.
There are several benefits to this method over the first one…
[Options]
table. (You could, of course, omit the approval features and just let all new entries auto-add like the above scenario, but I personally prefer to use the approval options.)[Options]
table to count the linked records tied to each option, allowing you can see how many times each option has been chosen.I hope that these tips are helpful!
Mar 20, 2021 09:55 PM
This is awesome, @Justin_Barrett!! Thank you for sharing this with the community! :grinning_face_with_big_eyes: :raised_hands:
Mar 21, 2021 02:54 AM
Great post @Justin_Barrett !
Apr 13, 2021 08:57 AM
What a brilliant solution. Thank you @Justin_Barrett for this amazing tip. Can’t wait to put this to use everywhere. :grinning_face_with_smiling_eyes:
Jan 17, 2022 01:25 PM
I’m trying to translate this for a Multiple Select instead of Single Select and can’t figure it out. Is that even possible?
Jan 17, 2022 01:31 PM
It should be doable. Are you able to share specific details about how you’ve tried to implement it and the problems that you’re encountering? Screenshots (even doctored to hide private data) would be immensely helpful.
Jan 17, 2022 02:22 PM
Stumbled onto this bit of code from a previous poster (made some customizations) …
const
targetField = base.getTable('Businesses')
.getField('Business Type'),
tfChoices = targetField.options.choices,
name = 'Option';
if(!tfChoices.map(choice => choice.name).includes(name))
await targetField.updateOptionsAsync(
{choices:[...tfChoices,{name}]}
);
… but all it’s doing is creating a new option named “Option” if it doesn’t already exist. I know I might be a bit over my head, but I don’t know how to use variables so that the ‘name’ field works properly.
Jan 17, 2022 02:49 PM
I’ve also tried your first option a few different times, but I keep getting stuck here.
It won’t let me run the test and it doesn’t work. I can’t figure out what I’m doing wrong.
It also seems like in a Multiple Select situation that automation would need to be added to de-select “Other”. I’m also trying to figure out how to do that and can’t figure that out either.
Jan 17, 2022 03:02 PM
I don’t have time to dig any deeper right now, but I’ll bookmark this for tomorrow. However, I can quickly clarify one point:
You can only run a test on a given action if you have run a successful test on the previous action. That’s required because each action passes data to the action(s) after it. Without running tests on prior actions, later actions don’t have access to that passed data and often can’t be configured because it’s missing.
Apr 11, 2022 07:19 AM
Hey, I would love to apply this to my base, but I’m not totally sure how to apply it to what I have set up. Basically I have a table for “Companies” and a table for “Contacts,” And I have it so that the Companies table has a column that links to contacts table, and vice versa. I have a form I’m creating to make it easier to input new companies, but as I’m sure you are aware, it doesn’t let me create a new linked contact.
These table are already populated with information, and I’m pretty new to the airtable world, so I’m not totally sure how to apply your solution in my scenario. I also want to leave it so multiple selections can still be made.
Any wisdom or guidance would be greatly appreciated!