woensdag 19 mei 2010

Access Form Control without Autodeclaration

Source: http://www.artofcreation.be/2010/04/13/odd-code-in-ax-2-control-enum-on-forms/

Example: disable control named "ButtonFunctions".
element.control(Control::ButtonFunctions).enabled(false);

Also: http://dynamicsuser.net/forums/p/43984/222374.aspx
Enable/disable form field in datasource field modified method:

public void modified()
{
    super();

     if (CEMPAbsence.Accrual == Accrual::Yes )
    {
        CEMPAbsence_ds.object(fieldNum(CEMPAbsence,AccrualType)).enabled(True);
    }

1 opmerking:

  1. This method does not trigger field validation, so you have to write your own validatewrite to check for example if a field you made mandatory is filled in.
    See http://objectmix.com/axapta/788789-after-setting-fields-manadatory-code-no-validation-happens.html

    The following method DOES trigger validation:
    formControl = element.design().controlName('NameOfField');
    formControl.mandatory(true);
    See http://daxdude.blogspot.be/2010/11/making-independent-form-controls.html

    BeantwoordenVerwijderen