Mandatory property for DialogField

Usually in Dialog Forms it's unable to set mandatory property for Dialog Fields. The lack of this property sometimes annoyed me. At the end I've decided to eliminate this gap :-) To expand the standard functionality you need to do the following steps: 1.Add mandatory() method into DialogField class:
void mandatory(boolean r)
    str name;

    // If properties exists then we are on server
    if (properties)
        name = #Propertymandatory;
        if (! properties.exists(name))
2. Add into unpack() method following lines:
case #PropertyMandatory:
        this.mandatory(unpackedProperties.valueIndex(i)); break;
Now you may enjoy mandatory property in Dialog Forms. This trick published in Axaptapedia too.


Dodge said...

Hi Ruslan i have followed all the steps and when i copy the code that is to be written in the unpack method it throws some saying Macro does not exist .im unable to solve this error.wud u please help me solve this..

Ruslan Goncharov said...

Take a look at \Macros\Properties macro

Is there #define.PropertyMandatory('Mandatory') line?