Select to view content in your preferred language

Define a required field

470
3
02-19-2020 11:27 PM
ModyBuchbinder
Esri Regular Contributor

Hi All

I am trying to find a way to define a field that the user MUST fill before saving.

I have tested many options:

1) Mark the filed as not null just make pro fill the field with some system default before save.

2) Use the option is required in the add field GP tools have no affect.

3) Trying to use constrain attribute field does not let me add a feature since the initial value is null (the user need to fill afterword). It is the first example here: Attribute rule script expression examples—Geodatabases | Documentation  but I am not finding the way to run it.

4) Trying validation rule fail too.

5) Giving default value (or use edit template with pre define value) does not do what I need - the user MUST enter a value.

Is it too much to ask for?

Thanks

3 Replies
ThomasColson
MVP Frequent Contributor

"Giving default value (or use edit template with pre define value) does not do what I need - the user MUST enter a value."

How is that not meeting the need? 

0 Kudos
ModyBuchbinder
Esri Regular Contributor

When you order a flight ticket you MUST say if you are a Male or Female. There is no default here and it is required field.

We need something similar.

Thanks

DanPatterson_Retired
MVP Emeritus

Couldn't you use a value list with the default set to None  (ie None, choice1, choice2), then simply have the tool check for None.  If there is no selection (ie, None) then have the script fail to process anything and report why.  There doesn't appear to be any "setEnabled" option to disable the Run button for any of the tool types to prevent people simply hitting Run with defaullts showing. 

0 Kudos