I want to make the category read only when the item number is "SMS*", and when the item number = other value(not "SMS*") , the category still can be edited.
Can anyone give me a hint or a sample code.
Thank you in advance.
I want to make the category read only when the item number is "SMS*", and when the item number = other value(not "SMS*") , the category still can be edited.
Can anyone give me a hint or a sample code.
Thank you in advance.
Hi Obsidian123,
At least consider using e.g. a parameter or new table to setup which category or categories would be restricted. The requirement is now about the SMS category, but next month, it could be changed to SMS and another category. Check with the client if they expect a list or just one category to be restricted.
Then based on the table setup or a parameter, you can add the coding as suggested above by Martin.
I'm sorry that I forget to say that when the item number is "SMS*" the category will be automatically set to "SMS", and my client want it can't be changed(read only).
I agree with Martin, don't hard code any "SMS" check in your logic. Instead add a new checkbox InventTable (or EcoResProduct) to control the behavior. And you can also add it in "Create new product" / "Release product" dialog/s so that the person who creates / releases the products can set it.
Run the logic in active() method of the form data source.
Get a reference to the data source field (this.object(fieldNum(...))), call its allowEdit() method and pass true or false, depending on your logic.
By the way, the fact that you need to extract a part of item number suggests that your data model isn't correct. The attribute isn't atomic.
André Arnaud de Cal...
291,735
Super User 2024 Season 2
Martin Dráb
230,466
Most Valuable Professional
nmaenpaa
101,156