This post is machine-translated. The original post in german language can be found here.

Control editing form fields

If you want to control which of the fields on a form are editable, you can use the property allowEdit of the datasource fields. If you have large tables containing a lot of fields, this could be a time-consuming process.

So, if you have a form, where the user should only be able to edit one field - in particular case a field from table salesLine -, you could use the following code-example which should be included in the init-method of the datasource. The snippet disallows editing for all fields exept for one field. 

public void init()
{
    sqlDictionary   sqlDictionary;
    ;
   
    super();

    while select sqlDictionary
    where sqlDictionary.tabId   == tableNum(salesLine)
       && sqlDictionary.fieldId != 0
    {
        if(sqlDictionary.name != "dataareaid" &&
           sqlDictionary.name != "recversion" &&
           sqlDictionary.name != "recId"
        )
        {
            salesline_ds.object(sqlDictionary.fieldId).allowEdit(false);
        }
    }
    salesline_ds.object(fieldNum(salesLine, blocked)).allowEdit(true);
}

Tested in AX 3.0
 

These post applies to following version:
Axapta 3.0

Add comment
 
 

 

 
 
 
Posts of the actual month
April 2024
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.