Require one input based on response from another input?

I’m working on updating my Goodnight Ubi app to add some optional functionality. Specifically I want to allow the app to optionally turn on some lights. Then, the user can also select to have this turned off later, and finally specify a period of minutes later for when they turn off.

The inputs are easy enough:

Which lights?
Turn 'em off later?
How much later?

But here’s the thing: The lights are of course optional. If the user doesn’t want to turn any on s/he doesn’t add an here. But what I want is for the second question: “Should I turn them off later?” to be required if lights are selected, but otherwise optional.

Furthermore, the third question: “How many minutes later?” should also be optional, unless the user said yes to turning them off later, then it should be required.

Is something like this possible?

I don’t know if you can do it “automatically”. Otherwise, you could put the “Should I turn them off later?” question on a second page as the easy way to do it. If you want them all on one page, maybe you could try validating the input yourself before doing the install and then send them back to that page if they haven’t entered the value you want.

1 Like