Force a field to be mandatory if a selection in drop down is selected?

Hi all

Is it possible to force a field to become mandatory if a certain selection is made in a drop down list? If the selection isn’t made then the field is there but not mandatory?

For example, there is a drop down choice of A, B, C and D. The field SELECT is always shown but you don’t have to enter anything into it unless you select either choice C or D.

Is this possible and how would I go about it.

Thanks :slight_smile:

1 Like

Just for clarification, you have a choice component and another entry component, and that second entry component is the one you want to be required or not?

For something like that I would create two entry components. One marked as required and another that isn’t. Then conditionally show each one depending on the value in your choice component.

3 Likes

Yep! What Jeff said is best practice. Use visibility conditions to show either a required field or a non-required field based on the screen —> value.

3 Likes

Hi Jeff

This is actually what I ended up working out to do. So for choice A and B I had field 1 display whixh was not mandatory. For choice C and D I had field 2 display and it was mandatory. But what I thien had was field 3 which wasn’t an input field by the user but rather by the submit button. On submit if choice was A or B I copied field 1 into field 2 ans 3. If choice was C or D I copied field 2 I to field 1 and 3. That way if the choice was ever changed, the change was reflected in “real” field 3. Hope that makes sense :joy_cat:

Might not be the right way to do it and I’m happy for advice on the right way but it seems to be working.

2 Likes

Oh great. I ended up doing that before Jeff advised but I took it a step further so that if choice was changed, the data in the field (because the fields would change) would update a master field per say.

I think I understand what you are saying, but what I would maybe do differently is have both the required and non-required entry components pointing to the same column in the table. That way you wouldn’t need a third field or any On Submit actions to copy things around.

2 Likes

Ohhhh yeah that makes sense! Thanks!

3 Likes

Oh that works much better! I over complicated because I didn’t realise you could ignore the red warning that says two fields pointing to same column. :joy_cat::joy_cat:. Thank you!

3 Likes