Search code examples
axaptadynamics-ax-2012dynamics-ax-2012-r3

Prevent adding white space in VATNum


In TaxVatNumTable form, i need to eliminate white spaces in the field VATNum when a new record is inserted. Now, what i already did is to override the modifiedField method on the TaxVatNumTable:

public void modifiedField(FieldId _fieldId)
{
   super(_fieldId);

   switch (_fieldId)
   {
        case fieldNum(TaxVATNumTable, VATNum):
        this.VATNum = strRem(this.VATNum," ");
        break;
    }
}

Works pretty well but is there another way to accomplish this? I am thinking at something like OnPreviewKeyDown event in WPF, check the pressed key and if space, do nothing. Is this possible?


Solution

  • The way you have done it is the best way to do it.
    The TextChange method implies test for each keystroke, never do that in AX.