Ninox 4 – Read-only fields that scripts can still write
TNinox 4 – Read-only fields that scripts can still write
Problem
In an approval workflow, status, request_date, approved_by and approval_date must only be changed by the Submit / Approve / Reject buttons. A manual edit to status makes a request look approved without the Approve script ever running.
Can edit if = false didn't help: in my tests it also blocks script assignments (status := 2 had no effect). Role permissions weren't available on my plan.
Solution
Set the 4 fields to Visibility → Hidden. Scripts still write to them.
Add a Custom component that shows the same values styled like native fields (read-only).
Turn off Inline editing in table view.
let r := this;let st := number(r.status);
let bg := if st = 1 then "#bfdbfe" else if st = 2 then "#4ade80" else if st = 3 then "#fca5a5" else "#e5e7eb" end end end;
let lbl := "font-size:14px;color:#374151;margin-bottom:8px";
let box := "height:40px;background:#eceef1;border-radius:12px;display:flex;align-items:center;padding:0 12px";
<div style="display:flex;gap:9px;flex-wrap:wrap">
<div style="width:294px"><div style={ lbl }>Status</div>
<div style={ box }><span style={ "padding:3px 12px;border-radius:999px;background:" + bg }>{ if r.status = null then "Draft" else text(r.status) end }</span></div></div>
<div style="width:231px"><div style={ lbl }>Request Date</div><div style={ box }>{ format(r.request_date, "DD/MM/YYYY") }</div></div>
<div style="width:354px"><div style={ lbl }>Approved by</div><div style={ box }>{ text(r.approved_by) }</div></div>
<div style="width:294px"><div style={ lbl }>Approval Date</div><div style={ box }>{ format(r.approval_date, "DD/MM/YYYY") }</div></div>
</div>
UI protection only, not real security.
Question: is there a native way in Ninox 4 to make a field read-only for users but writable for scripts?
Antwort
Content aside
- vor 13 StundenZuletzt aktiv
- 3Ansichten
-
1
Folge bereits
