How to create a toggle button?

#1

I am trying to create a button that changes a field from “IN” or “OUT”. So every time you click the button it switches it from one to the other. Click once and it changes it to “IN”. Click it again and it changes it to “OUT”. I can do two separate buttons where one button will change the status to “IN” and the other button changes it to “OUT”, but it would be nice to have one toggle button that can switch it.

Thanks

#2

Hi Jennifer

You can use the If formula to specify what the next state of the field should be. Here is a document you can use to try the feature.

Himanshu

4 Likes
#3

Thank you for replying. I clicked on the link you included, but it said I didn’t have access. I clicked on the request access button.

#4

Sorry about that Jennifer. I have shared the document with you and also opened it up to everyone with an account in case others want to take a look.

#5

That worked. Thank you so much!!

#6

This is great Himanshu. Thanks. To save space, the ‘Occupied’ column could be hidden if you use a formula for the button label (=Occupied). In a perfect world, the button would be color controlled (green=on) too but color apparently applies to the entire column. Perhaps the developers could allow a formula for every button attribute (Color, Icon)?

1 Like
#7

Hi Himanshu,

I’d really like to look at the formula you used for this doc but it seems like the doc is corrupted now. I’ve been trying to copy an earlier version of it, but I can’t seem to be able to scroll down in the version history pane.

I tried the latest and the earliest version I was able to copy (Feb 16 2019, 8:57 AM), and whenever I click on the button column format, I get an error that closes the doc and asks me to reload it… :confused:

#8

Dear @Andreea_Cri

You are right the doc is corrupted.
In the below link you can find a simular doc, to see how the formula works

Amicable,
//JP

#9

Hi @Himanshu ,

It appears you made the document editable by everyone, and someone accidently messed up the formulas. I have created a new table with the correct formula.

I recommend you set the document to view/play and post an embedded copy so people can try it out and view the formula.

Cheers,
Lloyd

#10

Hi Andreea

I have restored the document. Thanks for pointing out that the document was no longer working!

Thanks
Himanshu

#11

Thanks for pointing this out Lloyd. I had shared this document last year and we didn’t support play mode back then. I forgot to go back and change the link after we implemented it. I have fixed the document and the link now.

#12

No problem. For the record, I think a button that toggles between “ON” and “OFF” itself is sleeker, but perhaps not what was originally asked :wink:

Lloyd