"This input should not be empty" as a Property Option for Conditions

I’m trying to do form validation where several fields are mandatory only if some other fields are populated. So if input A is filled in then input B must be filled in, otherwise it can be blank.

It occurs to me that if “This input should not be empty” was available as a property in the Conditions tab, I could set a condition on Input B to say when input A’s value is not empty, “This input should not be empty” = True.

I reckon this would make form validation much easier. At the moment I’m having to create multiple workflows for one form, each with a different “and When” trigger. I would welcome any suggestions on other ways to do this.

1 Like

You could try first setting the conditionally mandatory inputs [input B] to disabled, then build a conditional for [input B] 'When [input A] is not empty this input is disabled - then uncheck the disabled box.

Let me know if that works or not. If you need more clarification I can do the screenshot thing

Thanks @skylershelton. I’m already doing this but the problem is that once [input B] is enabled, the user can still save without typing anything into it, which is what I’m trying to prevent. So what I’m doing in addition, is to disable the Save button if [input A] is not empty and [input B] is empty.

Did you try setting to “This input shouldn’t be empty”?

@skylershelton, I did, hence my original question, but your question gives me an idea (and maybe it is what you’re suggesting). So what I’m thinking is that if I make [input B] mandatory (“This input shouldn’t be empty”) and disabled by default and then when [input A] is not empty, enable [input B].

I’ll try this but I suspect this will mean that [input B] will always be mandatory, even when [input A] isn’t filled in, which of course is not what I want. Always worth a try though. I’ll give it a go. Thanks again.

Yea, that is what I meant. I think that if the input is disabled the “this input is mandatory” setting is ignored.

1 Like

@skylershelton, you’re absolutely right. I didn’t know that. Super useful and makes total sense. Much appreciated.

1 Like

@emmanuel, can I ask you to please confirm that the behaviour described by @skylershelton above will remain so going forward? I ask because a) I seem to be seeing some inconsistent behaviour and b) I don’t see it documented anywhere and I worry therefore that it may be an unintended ‘feature’ that may change in the future and break my app.

can anybody confirm this behaviour?

AFAIK, everything in this thread is still accurate. If you’re experiencing issues I recommend starting a new thread with your specific use case, that way it would be less confusing while combing the archives! :smile:

I just want to second the original idea of having “This input should not be empty” as a conditional property.

My app involves allowing users to construct their own forms for data entry, and I really need to allow them to choose whether fields should be mandatory or not. As there’s no conditional for this, things are made much more difficult. I suppose I can technically have duplicate fields for each input, one with “should not be empty” ticked and one without, and hide one or the other conditionally, but that’s one hell of a workaround for what should be very simple to do.


Another vote for this. I am not sure why this particular property is not able to be conditionally controlled, but I have a use case now where I want an input to always be visible and active, but it should be a required field for some users and optional for others based on a setting in their profile.

I guess what I will have to do for the time being is put two input elements on the page, one required and one not, and then conditionally show and hide them.

Can someone from Bubble comment on whether this is likely to get on the roadmap? The request has been around since 2016 and the workaround for the lack of this feature is cumbersome. It requires making duplicates of all the elements on a page that you need to have conditionally required, requiring much more complexity in the workflows, etc.

It is also pretty standard from a capability standpoint in other languages/platforms. I don’t know any tools I have used where I have to make an second control and swap between them just because I want to require data sometimes and not others.

@emmanuel or @josh ???

1 Like

Tested this as I need a conditional should not be empty and it appears to only work if the element is not visible. When it’s set not to be visible it will ignore the should not be empty value.

Another vote for this feature

1 Like