web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Use of Property "Editing" in Pages using C/AL Code.

(0) ShareShare
ReportReport
Posted on by

Hello All,

I need help with the following:  

In Dynamics Nav 2013, I have a Page type CardPart, where I have set a source table to manage data, on page I added the fields from that table. I do some field validations using C/AL Code, with respect to enable editing in a field if the condition introduced in a previous field is met and if is not met I want to disable the field.

I tried to do, in the following ways:

  •  Field.Editing(FALSE);
  •  CurrPage.Field.Editing(FALSE);

However, in both ways I get the following error:  

    ---------------------------

    Microsoft Dynamics NAV Development Environment

    ---------------------------

    You have specified an unknown variable.

    Editing

    Define the Variable under 'Global C / AL symbols'.

    ---------------------------

    Ok

    ---------------------------

Could anyone tell me how can I?.

 

 

Best regards,

Marlon T. Ramirez

*This post is locked for comments

I have the same question (0)
  • Benoit Delvaux Profile Picture
    870 on at

    I think you need to use the EDITABLE property instead of the EDITING one.

    Use the C/AL Symbol menu to find out :)

  • Community Member Profile Picture
    on at

    In C / AL code I can not make a field editable property.

    And yes you're right, I was wrong the truth the right word is editable, but even so I can not use it, because said property I can not not even see in the C / AL Symbol Menu, this only appears for the page, but the page I do not want setting it but only the field or control that I specify. :)

  • Suggested answer
    Neville Foyn Profile Picture
    4,320 on at

    Hi

    Yes it is not possible to change only a field to editable,

    Rather what you need to do is to set the "On Validate" code of the field in the form or page to check if it is allowed to be edited then generate an error if not, the error will cause the system to empty the field again

    Field - on validate()

    IF Rec.OtherField = '' THEN

     ERROR('you cannot fill in this field if the other one is blank');

    Hope this makes sense

    Nev

  • Verified answer
    Mohana Yadav Profile Picture
    60,999 Super User 2025 Season 2 on at

    Take a boolean variable (ex: fieldeditable)

    set it to false in the begining of the onOpen page

    Based on the your first field validation, change it to true

    set the boolean in second field editable property..

  • Community Member Profile Picture
    on at

    Dear Mohana,

     

    I created a Boolean variable named EditarSucursalInv in the C/AL Global.

    1667.02-_2D00_-Properties.jpg                       

     

    Then I added to the property "Editing" of my control.

    0820.03-_2D00_-C_5F00_AL-Editor.jpg

     

    After initialize the variable in Event "OnInit()" of the Page.

    5481.04-_2D00_-C_5F00_AL-Editor.jpg

     

    And finally reassign the variable in Event "OnValidate()" of the field that triggers the validation of editing changes.

     

    Only that's what I did, but it does not work, because although disabled the field, since the code that I put in the Event "OnInit ()", was executed, but it when running the Event "OnValidate ()" is not generates unchanged, that is, it is always disabled.

     

    Could you to send me an example with Nav controls, how would you?

     

     

     

    Best regards,

    Marlon T. Ramirez

  • Neville Foyn Profile Picture
    4,320 on at

    I have tried this before and was unable to get it to work then, but gave it another try and still no luck,

    Are you sure this works Mohana?

  • Suggested answer
    s.smith Profile Picture
    on at

    Hi Marlon,

    It can be done very easy.  You do not use Editable - but Enabled.

    On the fields you want to be editable, you make the enabled depending on a Boolean value.

    This boolean you control both from OnOpenPage, and later from the validate on the different fields.
    I suggest you make a function you call with the FieldNo each time, so you keep it all centralized and the code clean.
    On OpenPage you call the function with a 0  (zero), which in the function will process all the fields.

    You can see an excellent example on this on the standard Item Card.

    Kind regards

    Soren Smith
    ---------------/////////---------------
    NAV Developer, Consultant
    Certified trainer since 1998

  • daniel.t Profile Picture
    5 on at

    One small thing. When you declare the boolean variable, don't forget to set the property IncludeInDataset to Yes. Otherwise, you'll get an error because the program can't find the variable.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Yes this surely works, for an example look at page 21 customer card, how ActivateFields function is used for contact no. fields.

  • mmv Profile Picture
    11,471 on at

    Hi Neville,

    It works, you are to ensure that the "IncludeInDataset" property is set to True.

    Best Regards,

    MMV

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans