How to conditional lock fields
Mario Höfer
Hi,i looked into the lock fields sample and it worked quite well.
But i need an additional condition to lock the field.
I have done this so far:
Two fields are used in the Form ServiceCall.
One field is locked under all circumstances except if the form is in FormMode Find.
Another field should be locked if the first field contains a value.
Right now it doesn't seem to work right.
The first field is correctly locked, but the second depends on the conditions.
If I open the ServiceCall Form and jump directly to the last entry (which shouldn't be locked) everything works. But if i move from one which is locked to the one which should not be locked, the field stays inaccessible.
If i do i the other way (move from an unlocked Call to one that should be locked), the field stays unlocked until i click into the UDFForm and back in the main form (switch focus).
So it seems the EventType FormActivate doesn't work with this rule.
Do you have any ideas, how to solve this problem ? Or does anyone have another solution ?
This is the Code is used so far:
string[] itemsToLock = new string[]{""};
if (!String.IsNullOrEmpty(TextEdit.GetFromUID(pVal.Form.UDFForm, "U_ServID").Value.ToString()))
{
itemsToLock = new string[]{"40"};
LockFields(pVal.Form, itemsToLock);
}
return true;Thank you very much.
Mario
Attachment
[url=http://www.coresystems.ch/wp-content/../wp-content/forum-image-uploads/mariohofer/Rule.png]Rule.png[/url]
Michael Egloff
Hello Mario,use the FormDataLoadEvent, check if the field is empty and then you have to lock the field by yourself. The wizard helps you to lock fields the easy way. Conditional lock is not supported by the wizard.
Mario Höfer
Hello Michael,thank you very much. I tried to use the FormDataLoad event, but it doesn't work reliably. I want to lock the field problemTyp in the service call form, if another field (UDF) is filled.
It works most of the time, but if i change the status of the call (for example from open to a custom status..) the field is unlocked.
Is there a way to get a field locked, as long as another field is filled ?
I need this later on, because i want to lock the whole form depending on the status and the user who is logged in.
Thanks again,
Mario
0
Please sign in to leave a comment.
Comments
0 comments