Skip to content

Commit 7c29317

Browse files
Create UI Policy Best Practice
1 parent 3e765c6 commit 7c29317

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

UI Policy Best Practice

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
7. UI Policy Best Practices
2+
Description: This check ensures that UI policies are used effectively, including hiding fields rather than disabling them when applicable.
3+
4+
Example: Check if UI Policy uses disabled instead of hidden.
5+
Best Practice: It's often better to hide fields instead of disabling them for better user experience.
6+
Scan: Identify UI policies that disable fields instead of hiding them.
7+
javascript
8+
Copy code
9+
function(uiPolicyCheck) {
10+
var script = uiPolicyCheck.getFieldValue('script');
11+
if (script.indexOf('g_form.setDisabled') > -1 && script.indexOf('g_form.setVisible') === -1) {
12+
uiPolicyCheck.addViolation('UI Policy uses "setDisabled" instead of "setVisible", which may lead to a poor user experience.');
13+
}
14+
}

0 commit comments

Comments
 (0)