Is it possible when I select form drop down menu:
1. Change from DD, subforms(Sub_B and Sub_C or the fields)
to become read only or disable or gray out?
2. Leave from DD, subforms(Sub_A and Sub_C or the fields)
to become read only or disable or gray out?
3. Termination from DD, subforms(Sub_A and Sub_B or the fields)
to become read only or disable or gray out?
Thanks
Views
Replies
Total Likes
Hi,
Here is a basic switch statement. If there are only a few objects in each suboform, then you could set the access to readOnly/open for each one. If there are a lot of objects then you could use Paul's LoclAllFields example. With one function to lock fields and a similar one to unlock fields.
In some ways it is easier to hide subforms if they are not required.
You can also script to grey out the field, if that is also needed.
Good luck,
Niall
Views
Replies
Total Likes
Finally, because I have a lot of fields I applied Paul's script but there is a problem!
Here is the script on change event:
switch
(xfa.event.newText)
{
case "Change":
myScriptObject.LockAllFields(form1.PageA.Sub_A);
myScriptObject.LockAllFields(form1.PageA.Sub_B);
form1.PageA.Sub_C.access
= "open";
break
case "Leave":
myScriptObject.LockAllFields(form1.PageA.Sub_A);
myScriptObject.LockAllFields(form1.PageA.Sub_C);
form1.PageA.Sub_B.access
= "open";
break
case "Termination":
myScriptObject.LockAllFields(form1.PageA.Sub_B);
myScriptObject.LockAllFields(form1.PageA.Sub_C);
form1.PageA.Sub_A.access
= "open";
break
}
When I pick Change item form the DD menu is OK.
After if I have to pick Leave: Sub_B remains LOCKED than Open!
Same if I have to pick Termination: Sub_A remains LOCKED than Open!
Seems something wrong with the script :form1.PageA.Sub_C.access = "open";
How I can correct that?
THANKS AGAIN
Views
Replies
Total Likes
Hi,
The trick is to copy Paul's function within the script object and create a second function called UnLockAllFields. Then change the script in this function from readOnly to open. There is also a LockAllFields line that needs to be changed as well to UnLockAllFields.
Then your switch event would look like this:
myScriptObject.UnLockAllFields(form1.PageA.Sub_C);
Sample attached.
This really is Paul's solution.
Good luck,
Niall
Views
Replies
Total Likes