CurrForm.EDITABLE := FALSE impact on individual fields

Hi there,

I apologise if this has been answered elsewhere in this site - I wasn’t able to find an answer through my searching.

I’m attempting to restrict access on a form. I only want to allow access to a small number of fields. I’ve put the below code (example) in OnAfterGetRecord

CurrForm.EDITABLE := FALSE;
CurrForm.“Name”.EDITABLE := TRUE;

However, it seems that the last line is not working i.e. the Name field is still read only. I checked this with other fields In my code and I’m sure I haven’t made a type or anything.

If I switch the code logic around (just for fun) :

CurrForm.EDITABLE := TRUE;
CurrForm.“Name”.EDITABLE := FALSE;

It works as you would expect - the entire form is editable, with the specified field read only.

Am I missing something here? Does the CurrForm.EDITABLE:=FALSE take precedence over the individual field setting?

Thanks!

Mark

Yes, table properties override form properties and form properties override text box properties. Search for “editable field on uneditable form” or similar and you should find a work around using the OnActivate and OnDeactivate triggers for a text box. That or mark all of the fields one by one.

Thanks for the reply. I was able to find the other posts which you described & was able to get it working as per those.

On a related matter, prior to getting your response, I had manually set all the fields individually (in code) to .EDITABLE:=FALSE

On the Customer Card, we have the same field repeated on multiple tabs, for example the “Phone No.” appears on the General tab and Communication tab.

With the approach of setting fields to false, CurrForm.“Phone No.”.EDITABLE := FALSE; only the first occurance of that field becomes read only. The second occurance, i.e. on the communication tab, was not set to read only.

Do I need to specify a different statement to set both to read only? We have a couple of fields on different tabs for flow of information purposes.

thanks, Mark

Just answered my own question. By assigning an name to the second textbox, and referencing by name, made it read only.

thanks, Mark

Hi,

I think you can use ENABLED(FALSE) instead of using EDITABLE option.

Eg. CurrForm . “Field Name”. ENABLED(FALSE);

This will solve your purpose .

Regards

Karthick J

Just an appendix: did you know that forms like 25 (Customer Ledger Entries) and 132 (Posted Sales Invoice) are editable? Each and every form-field (textbox) has property Editable=TRUE. This is standard since Navision Financials.

If you put a new field into it will be totally open. Ok, CustLedgerEntries are handled by codeunit 103, called from form-trigger OnModifyRecord, but in form 110 there no check what so ever.

I think you mean form 130 (table 110) where you will find:

Form - OnModifyRecord() : Boolean
CODEUNIT.RUN(CODEUNIT::“Shipment Header - Edit”,Rec);
EXIT(FALSE);

which handles this.

In form 130 the edit will be handled, that is correct.

But forms 132 and 134 (Posted Invoice and -Credit Memo) do not have that code. Has allways been like that since at least Financials 1.30, and still remains in NAV 2009.