RE: Edit a field based on a checkbox,
Hello,
I have some smaples using Enabled property, on page fields Enabled attribute you must assign EditCustomField variable, something like this:
field("Warning 1"; Rec."Warning 1")
{
Enabled = EditCustomField;
ApplicationArea = All;
}
Using Enabled must works too, I have created this sample page and it works:
page 60000 TestPage
{
PageType = Card;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = Integer;
SourceTableTemporary = true;
SourceTableView = where(Number = Const(1));
Editable = true;
layout
{
area(Content)
{
group(GroupName)
{
field(SearchString1; SearchString1)
{
ApplicationArea = All;
Editable = CanEdit2;
}
field(SearchString2; SearchString2)
{
ApplicationArea = All;
Editable = CanEdit2;
}
field(ItemEntry; ItemEntry)
{
ApplicationArea = All;
Editable = CanEdit2;
}
field(CanEdit; CanEdit)
{
ApplicationArea = All;
trigger OnValidate()
begin
CanEdit2 := CanEdit;
end;
}
}
}
}
var
SearchString1: Text;
SearchString2: Text;
CanEdit: Boolean;
CanEdit2: Boolean;
trigger OnOpenPage()
begin
CanEdit := true;
CanEdit2 := true;
end;
}
Is not necessary to have two boolean variables, with one only CanEdit you can avoid OnValidate code.