Hello,
I have a task to make a custom field editable based on a checkbox,
If checkbox is checked the user can edit the specific field.
I have create a boolean variable EditCustomField,
And in Onvalidate of the checkbox and o Onaftergetrecord (page) i have done this:
IF Edit = TRUE THEN
EditCustomField := TRUE;
it does not wokr.
Could you help me please?
Hi, Hope the information below can give you some hints.
Dynamic Visibility of Controls (Hide and show fields dynamically)
Switching a page to non-editable in real time via a field value
Thanks.
ZHU
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.
can you paste all your code?
Did you assign the variable to the editable property of the custom field?
Is there any reason why you want to do it as editable only?
You can also simply write code under custom field onvalidate to check the boolean field
TESTFIELD(boolean,true);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156