Prevent Warning on READONLY

Questions about and code samples for custom order rules and validation within Select.
Post Reply
timothymeyer16
Posts: 33
Joined: Mon Jun 14, 2021 9:47 am

Prevent Warning on READONLY

Post by timothymeyer16 »

Code: Select all

def Task_Code_ReadOnly(args):
	
		# Allow changes if Blank
		if args.Context.Code == None or args.Context.Code == '':
			args.Value = False
			
		else:
			args.Value =



The idea in the above code is simple. If there is no Task Code, allow a user to input values. If a task code exists, make the field read only.


1.PNG
1.PNG (20.48 KiB) Viewed 239 times


The functionality is working correctly. After a user inputs data into a blank Task Code, the new code will remain and the field will become ReadOnly.


2.PNG
2.PNG (35.63 KiB) Viewed 239 times


The issue is an undesired "Can not access member" error pop-up. How do I prevent the error from showing?

Summary:
- Task Code is Blank and not ReadOnly
- Task Code is entered
- An undesired "Can not access member" error appears.
- The new task remains and the field is ReadOnly.


Notes:
- If the task is selected from a lookup table the error does not appear.
- I attempted to add the value with "Task_Code_Value(args), but could not configure it correctly."
BobRichards
Posts: 1228
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Prevent Warning on READONLY

Post by BobRichards »

I'm afraid there is nothing we can do about that. It is probably related to the way the Select application refreshes the screen when you are tabbing out of the field or some artifact of that.

The only thing I can think of is for you to enable the "Validate data entered in the key field" in the Task Code lookup table. Then at least the user cannot "fat finger" the field and change it to a value not in the table.
LUTable.png
LUTable.png (1.77 KiB) Viewed 230 times
Additionally you can disable the permission "ProForm\Order\Order Tasks\Task-Edit" for the users. This will prevent the user from editing the text in the Task Description field so it will always be set by the Code in the lookup table.
Task.png
Task.png (8.12 KiB) Viewed 230 times
Sorry but this is all you can do here.
Bob Richards, Senior Software Developer, SoftPro
timothymeyer16
Posts: 33
Joined: Mon Jun 14, 2021 9:47 am

Re: Prevent Warning on READONLY

Post by timothymeyer16 »

Thank you, this solves multiple issues for us!
Post Reply