You might want to write a script to handle the required values for field objects in your forms in order to make sure that entered values are acceptable. 4D already provides a means to do so.
In the Form Editor, you can assign a choice list, a required list or an excluded list to a field. This is performed using either the Property List or the Object Properties dialog.
Selecting a choice list for a field object in a form is almost the same as defining a choice list for the field at the structure level. The only difference is that, with the form, the List dialog will be displayed when the field receives the focus in that specific form. If this is defined at the field properties level, it will apply to all the forms.
Selecting a list as a required list means that users can type any value as long as the value belongs to the required list. Otherwise, an alert "This value is not allowed" will be displayed.
Selecting a list in the excluded list means that users can type any value as long as it does not belong to the excluded list. Otherwise, an alert "This value is not allowed" will be displayed.
It is usually useless to define both an excluded list and a required list for a given field. If you still want to do it for generic coding issues, you will need to be sure that both lists do not contain the same values. If this is the case, you will not be able to enter that specific value.