0

I was wondering if it's possible to check a StringEdit-field when user leaves this field in MS Dynamics AX 2009.

for example:

I have a field called cliHouseNumber, and I want to check if the user left the field.

Tassisto
  • 9,877
  • 28
  • 100
  • 157

3 Answers3

0

Create this method in the form methods;

edit String editcliHouseNumber(
    boolean set,
    String    _cliHouseNumber
    )
{
    if(set)
    {
        //It has been changed - do what you want to
        //in here...
    }

    return _cliHouseNumber;
}

Set your field property "dataMethod" to "editcliHouseNumber".

AnthonyBlake
  • 2,334
  • 1
  • 25
  • 39
0

Usually the correct place is the modified method in the datasource field or the modifiedField on the table. If you want to ensure, that a field is entered use the mandatory property on the. Do not try to force the user to remain on a not entered field.

These methods will be called only when a value changed, which is usually what you want.

Also see the answer to this question.

Community
  • 1
  • 1
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • 1
    I agree with you here. I think that you want to check that the field has been modified and make it mandatory rather than attempting to check it every time someone leaves the field. That would make extra method calls and slow performance. – Michael Brown Mar 08 '12 at 13:49
  • I did what you said but that's not what I needed. I don't want anything to happen when the field is modified. I want to call methods when the user leaves the field. And by overriding the method leave, this is possible. – Tassisto Mar 09 '12 at 10:24
  • In reality the field is likely to be data bound, but that is not mentioned in the question. This answer will only work if the field is data bound. – AnthonyBlake Mar 13 '12 at 11:18
-2

okay, here is another option;

enter image description here

Right click the field, and override the "lostFocus" method.

AnthonyBlake
  • 2,334
  • 1
  • 25
  • 39