Best way to verify that all fields has values

Hi

Even though the fields are set to mandatory they can be skipped before submitting the page(just don’t activate the field on the page).

Any good ideas to prevent the form to be submitted before all fields has be validated and filled
properly? The form contains of up to 30 fields, and I need to make sure that at least 28 of them is correctly filled, there is a lot of validation on each of the fields, but as stated they can be skipped.

I thought of using a bunch of true/False variables, or a sort of counter, so as soon as the value changes on each of the fields the counter is incremented or the boolean changes from false to true, but maintaining 30 booleans seems a bit overkill.

1 Like

@Michaeljep

Use type into modern activity
image

and check the condition in properties as below:
image

for example if you are trying to type Firstname, if you check that condition it will goes to next type activity to enter the further things or else it will throw the error

Hi

It’s in UiPath apps the form is, so it must be done there, but thanks for the proposal.

Hi

If you liked the answer please mark it as solution, someone could take the benefit from this post, if they encounter the same exceptions

it looks like you want to iterate over all form controls / fields e.g. text fields.

Have a look on the below code statement:

MainPage.GetType().GetProperties().Where(Function(p) p.PropertyType = GetType(Controls.TextVb)).Select(Function(p) p.GetValue(MainPage)).ToList()

and have a preview in which direction such a dynamics can go. But keep also in mind that this check has to be triggered multiple times (e.g. on the different field updates) or maybe you will set it to validate button which will trigger the submit button enable/disable to get it centralized

Hi,

if you want to verify each single field booleans would be a good reference. Think about, that maybe some fields only can be filled, when others are filled already. If so you can skip the validation of the fields before.

My Suggestion would be to Store all the Booleans in a Dictionary, so you can handle the final condition with “For Each Key-Value-Pair”

Regards