Hi all!
Is it possible, to set field property EDITABLE (or VISIBLE or ENABLED) in code of table? when i tried to write: field1.EDITABLE := FALSE i received following error message: "The variable is not a record. 'Variable.Field' is invalid". But field1 is not a variable, it is a field in a table!
Thanks!
0
Comments
But in this case field doesn't update till I go to another record and go back. currform.update didn't help.. Any other ideas? :-s
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
if Field1 <> '' then
Field2.ENABLED := FALSE
else
Field2.ENABLED := FALSE;
In trigger OnAfterValidate for Field1 I added such code:
IF Field1 <> '' THEN BEGIN
CurrForm.Field2.EDITABLE := TRUE;
CurrForm.UPDATECONTROLS;
END ELSE BEGIN
CurrForm.Field2.EDITABLE := FALSE;
CurrForm.UPDATECONTROLS;
END;
But it doesn't work!
You can try
in the OnAfterValidate trigger of the Field1 control.
It should work without an update
It should also be in the OnAftergetCurrRecord trigger. (the code that is)
Best is to make a function like in the customer card.
In table editable is TRUE...
Actually, I would like to find example and take solution from it, but I can't find it. I didn't find in Customer Card such a thing.. It seems, in Customer Card controls Editable properties aren't changed at runtime.. Am I wrong?
But you can make a test in a cronus database with the customer card.
Open it, click on the Name field.
In the OnAfterValidate trigger put this code
This shoud work.
Thats why a function is the best solution.
To see what triggers are used you can put messages into the trigger and try what triggers are used when browsing through record and changing values.
LOCKTABLE or codeunits are definately not calling form triggers.
But thanks anyway!
Every Sales Header has a boolean "Internet order"
If the "Internet order" = True then I want the "Unit Price" field on the Sales Line to be editable.
But I doesn't seem to work. It's always UNEDITABLE with this code.
Am I using the wrong trigger?
Also tried
http://www.BiloBeauty.com
http://www.autismspeaks.org
CurrForm."Unit Price".EDITABLE("Internet Order");
If the Internet Order field is also an editable field you'll also need to change the OnAfterValidate trigger if the FIELD with the same code.
Good luck!
If nesesairy I'm willing to make a small example and mail it to you. 8)
The imported orders set the "Internet Order" Checkbox to YES on the sales header
The Internet Order Checkbox is on the sales header.
We do not want the prices to be changed for any regular order but sometimes we need to adjust the price on the internet orders.
So the internet order flag is on the sales header and we want to lockdown the sales line "Unit Price" if it's not an internet order
My Current Code is
But the Unit Price Is uneditable if it's an internet order or not.
Does this work differently because it's a subform?
note:The Internet Order boolean is not editable.
http://www.BiloBeauty.com
http://www.autismspeaks.org
http://www.BiloBeauty.com
http://www.autismspeaks.org
Congrats.
http://www.BiloBeauty.com
http://www.autismspeaks.org
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Depending on if the boolean is true or not, the textbox displaying the Option should be Enabled or disabled.
As far as i know the CurrForm only displays items in the table attached to the form.
Do you have any suggestions to how I can access the control on the table ?