Required Validators on Dropdown's

I have a few screens with dropdown's on where the dropdown is required but for some reason the required validator doesn't trigger and I get a foreign key constraint error when trying to save the record. I can see the required validator is tied to the correct field property so am I doing something wrong? On one screen it would have been done with the scaffolder at the outset.

Thanks.

What is the value in the DropDown? It is most likely 0. I use a numeric validator.

Yes, check the type of that foreign key. It is probably of type whose default value is 0 and not null. If this is the case set the DefaultValue property of the RequiredValidator to 0 and should work.

2 Likes

Thanks, that really makes sense, thank you. I guess I was just a little confused as the scaffolded screens were like this too.