Hi David,
I don't know if you participated in the 2.41 EAP but attempts were made to do something similar, and display an asterix to the right of mandatory fields. I don't know the exact reasons it was abandoned but there were many different ways users wanted to show mandatory, asterix to the right, asterix to the left, different colour background, different colour border etc. , In the GWC if you still want to do this, it is case of adding a few lines to the .css file doing what you want to show the mandatory.
What also came out of that, was how do you define a mandatory field? For some it was if REQUIRED was set, for others it was if NOT NULL was set.
However there was one other thing that was observed. If you define NOT NULL, then when the form was compiled, it would also set REQUIRED e.g. So with this .per, note how in the resultant .42f the field with name not null also has required="1"
SCREEN
{
[f01 ]
[f02 ]
[f03 ]
[f04 ]
}
END
ATTRIBUTES
f01 = formonly.blank;
f02 = formonly.required, REQUIRED;
f03 = formonly.notnull, NOT NULL;
f04 = formonly.both, REQUIRED, NOT NULL;
<?xml version='1.0' encoding='windows-1252'?>
<Form name="formcompile" build="2.50.00-2239" width="7" height="4">
<Screen width="7" height="4">
<FormField name="formonly.blank" colName="blank" fieldId="0" sqlTabName="formonly" tabIndex="1">
<Edit width="5" posY="0" posX="1" gridWidth="5"/>
</FormField>
<FormField name="formonly.required" colName="required" fieldId="1" sqlTabName="formonly" required="1" tabIndex="2">
<Edit width="5" posY="1" posX="1" gridWidth="5"/>
</FormField>
<FormField name="formonly.notnull" colName="notnull" fieldId="2" sqlTabName="formonly" notNull="1" required="1" tabIndex="3">
<Edit width="5" posY="2" posX="1" gridWidth="5"/>
</FormField>
<FormField name="formonly.both" colName="both" fieldId="3" sqlTabName="formonly" required="1" notNull="1" tabIndex="4">
<Edit width="5" posY="3" posX="1" gridWidth="5"/>
</FormField>
</Screen>
<RecordView tabName="formonly">
<Link colName="blank" fieldIdRef="0"/>
<Link colName="required" fieldIdRef="1"/>
<Link colName="notnull" fieldIdRef="2"/>
<Link colName="both" fieldIdRef="3"/>
</RecordView>
</Form>
I also came across this when importing .per files into Studio to turn them into .4fd. A field that is defined as NOT NULL will end up with the Not Null and Required properties checked, this is because to do the import, Studio compiles the form to produce a .42f and then produces a .4fd from that.
Like you when I first saw this above behaviour I thought it was wrong, IMHO NOT NULL should set the notNull attribute, REQUIRED should set the required attribute, but this behaviour of not null setting the required attribute in the .42f has always been there.
To answer your question, are you sure you want to be testing the required attribute? It is possible to enter a blank or space into a field and satisfy the required attribute, IMHO the better test is to query the AUI for FormFields with the attribute of notnull = "1"
Reuben