Hide a field Form

AlkroAlkro Member Posts: 115
Is possible to hide any field in a Form with code?

I have this code in OnLookUp:

varItemLedgerEntry.LOOKUPMODE := TRUE;

FormEntries.SETTABLEVIEW(varItemLedgerEntry);
IF FormEntries.RUNMODAL = ACTION::LookupOK THEN BEGIN
  FormEntries.GETRECORD(varItemLedgerEntry);
  VALIDATE("Lot 1", varItemLedgerEntry."Lot No.");
  VALIDATE("Location 1",'10');
END;

With this, Item Ledger Entries form is opened, but i want user only could see Item and Lot fields, but i won't create a new form.

Regards

Comments

  • matttraxmatttrax Member Posts: 2,309
    You can, but it gets complicated. You have to change the text in the OnFormat trigger for each field you don't want to display. You also have to modify codeunit 1 (NOT recommended) or disable the Zoom feature for the users. Keep in mind that code on Forms does not translate to NAV2009.

    The best way really is to make another Form, though.
  • garakgarak Member Posts: 3,263
    you can make a new form or you do the following (but if the user has the permission to show coloumns, then he can display it)
    //In you "FormEntries" you define a function like this
    NotVisibleFields()
    CurrForm."Item no.".visible(false);
    CurrForm.OtherFields.visible(false);
    //and the other fields that are not visible
    
    
    //now we run the "FormEntries" form
    
    FormEntries.SETTABLEVIEW(varItemLedgerEntry);
    FormEntries.NotVisibleFields(); //here we hide the fields
    IF FormEntries.RUNMODAL = ACTION::LookupOK THEN BEGIN
      FormEntries.GETRECORD(varItemLedgerEntry);
      VALIDATE("Lot 1", varItemLedgerEntry."Lot No.");
      VALIDATE("Location 1",'10');
    END;
    

    Regards
    Do you make it right, it works too!
Sign In or Register to comment.