Dependent dropdown + Required/Required_If not working

Greetings,

I’ve created an app with Refs and a dependent dropdown list (fields “Imobiliária” e “Corretor”) - the field “Corretor” shows a list of employees depending on the chosen “Imobiliária”. The problem is that those two fields were configured to be “Required” but my employees have been able to save the form without filling those two fields.

image

I’ve tried to create many “Required_If” and “Valid_If” formulas as well, but still no success…

Is there something that I’m missing?
Thanks in advance.

This might happen if the required field is not shown - because AppSheet only enforces the required nature of a column when it’s shown.

  • If your valid if formula would result in 0 options, the field disappears - which then removes the required state for that field.

There are a couple of solutions, but my favorite is the following:

  • Apply the require formula on a different field, one that will always be shown.
    • Sometimes I add another virtual column to the table, that’s a LongText type with a formula something like this:

IFS(AND(
ISNOTBLANK([Column1]),
ISNOTBLANK([Column2]),
ISBLANK([Column3])
),
“Make sure you fill all the fields”)

I would actually go into much more detail, providing exact instructions on why the field isn’t working - but you get the drift I hope.

You can then apply a valid if formula to your new “alert” column:

isblank([_this])

where if that column has any value, it will not let the user save - but as long as it’s blank (which means that all criteria and things are as they should be), then a user wouldn’t even know it was there.

2 Likes

First of all, thanks for your response!

This might happen if the required field is not shown - because AppSheet only enforces the required nature of a column when it’s shown.

I did some testing and that’s exactly the problem!

Apply the require formula on a different field, one that will always be shown.

I do have fields that are always shown (not a virtual column), but I wasn’t able to create a require formula that demands filling the two fields - “Corretor” and “Imobiliária” - that I was having problems with.
I was using a DateTime field - “Data e horário de retirada” - that already has a formula (the app automatically fills this field) to test some require formulas, but I still had no luck…

image

At first I would like to try to resolve this issue without using and extra virtual columns. Do you have any ideas/suggestions of require formulas that would work?

Thanks!

1 Like

Put your valid if formula here, something like this:

AND(
{YOUR_PREVIOUS_CRITERIA},
isnotblank([Column_to_Enforce])
)

This will keep the original validation you’ve got, while throwing into the mix the requirement that another field in the table have a value as well.


If you want to get fancy, you can throw in a valid if error message that tells people what’s wrong so they know what to fix.

2 Likes

That works, but when someone attempts to save the entry without filling those two fields it shows “Invalid entry - Essa entrada é inválida, in portuguese”. The problem I’m facing now is that once that happens the fields “Corretor” and “Imobiliária” disappear from the form, so the user has to hit “Cancel” and start over.

image

Is there a way to continue to show the other fields after the entry is invalid?

Thanks!

I would think this has somethin to do with your show if formulas.

I’m not using any “Show_If” formulas. Would there be any formulas that I could use to force the fields to be shown?