Mandatory DialogField
From Axaptapedia
When adding controls to a standard form, either bound to a data field or not, one useful property is the Mandatory property. If this is set, then the control is shown with a red squiggly line if no value has been entered, and an error will automatically be shown when the user tries to save the record or close the form. This article describes how to also make this functionality available from dialog forms. You need to define the mandatory property in a DialogField class, as shown below.
1. Add mandatory() method into DialogField class:
// Created by GRR on 01.11.2005 void mandatory(boolean r) { str name; // If properties exists then we are on server if (properties) { name = #Propertymandatory; if (! properties.exists(name)) properties.add(name,true); properties.value(name,r); } else this.fieldControl().mandatory(r); }
2. Add into unpack() method following lines:
case #PropertyMandatory: this.mandatory(unpackedProperties.valueIndex(i)); break;
This solution was sourced from a post by Regards! Ruslan on the the microsoft.public.axapta.programming newsgroup.