What parameter blocks a field change?
block: true
Is this a server-side block or client-side?
This lock is on the client side — if a person knows JS
, they will be able to send the value bypassing this lock.
Therefore, locks through formatting are soft
.
About hard
locks on the server side will be discussed later. Formatting locks are protection against finger errors.
How do I unblock a field with a blocked row?
If you have a row blocked through string formatting code, then if the field specifies block: false
— the field will be unblocked.
Field formatting takes precedence over row formatting.
Is the field blocked only to change or to add, too?
When block: true
is passed, the field is blocked both for modification and during the addition process.
How can I lock a field only when adding row?
The string for adding does not have an id
, therefore:
f1=: setFormat(condition: #id = ""; block: true)
How do I block a field for a role or user?
There are two fast variables that return the role number or the user number:
$#nr
— (from now roles) returns a list of user role numbers.
$#nu
— (from now user) returns the user number in the user table.
For example, to block in the addition row only for role 2
:
f1=: setFormat(condition: #id = ""; condition: $#nr = 1; block: true)
For example, to block for everyone with status 3
and unblock for user 10
:
f1=: setFormat(condition: #status = 3; block: true)
f2=: setFormat(condition: $#nu = 10; block: false)