Skip to content

Bind a pluggable text template's contentparams, and report editable where Mendix has none (#928) - #191

Merged
ako merged 2 commits into
mainfrom
claude/widget-binding-gaps-928
Aug 19, 2026
Merged

Bind a pluggable text template's contentparams, and report editable where Mendix has none (#928)#191
ako merged 2 commits into
mainfrom
claude/widget-binding-gaps-928

Conversation

@ako

@ako ako commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Fixes both bugs in upstream #928. They turned out to be one bug wearing two hats.

The shared cause

isBuiltinPropName (mdl/executor/widget_engine.go) is a single flat list holding both ContentParams and Editable, and it backs both validators — MDL-WIDGET01 (pluggable) and MDL-WIDGET07 (static). It answers "is this a real MDL property name anywhere?", and both validators read it as "is this valid on this widget?". The engine then acts on each keyword only for the widget kinds that support it, and drops the rest in silence.

Bug 1 — fixed

One correction to the report: it is the first write, not the round-trip. No describe needed.

CE0720  "Place holder index 1 is greater than 0, the number of parameter(s)." at Image 'cardImage'

The stored BSON localises it — same page, two widgets, same syntax:

widget stored ClientTemplate
dynamictext (control) Text='{1}', Parameters=[2, {ClientTemplateParameter…}]
Image imageUrl Text='{1}', Parameters=[2] ← empty

The engine took the parameters path only for mxcli's {AttrName} convenience spelling, so Mendix's own numeric {1} form had no route at all. Both spellings now reach the same stored shape via a new SetTextTemplateWithClientParams on the builder interface and both implementations. After the fix the Image's template holds one parameter bound to Product.PictureUrl — identical to the control — and mx check is 0 errors.

Worth relaying to the reporter: imageUrl: '{PictureUrl}' already works on v0.18.0 and is an immediate workaround. The capability was never missing; only the {1} + contentparams: spelling had no route.

Bug 2 — cannot be implemented as asked, so it is now reported

The issue asks for editable:Editability/ConditionalEditabilitySettings on a button. There is no such field:

  • PagesActionButton has ConditionalVisibilitySettings but no Editability and no ConditionalEditabilitySettings.
  • Measured across generated/metamodel: exactly 11 Pages types carry editability — CheckBox, DataView, DatePicker, DropDown, FileManager, ImageUploader, InputReferenceSetSelector, RadioButtonGroup, ReferenceSelector, TextArea, TextBox — and none of the 14 button types does.

A button has conditional visibility, not editability. So the issue's own second option is the correct one: MDL-WIDGET20 warns and names visibility as the alternative.

Two details a reviewer should look at:

  • Both spellings are caught. editable: 'x' lowers to Editable, but the bracket form editable: [expr] lowers to EditableIf — and the bracket form is the one that genuinely works on input widgets, so leaving it unflagged on a button would have been the more surprising silent drop. I found the second key by dumping the parsed w.Properties, not by assuming it.
  • The list is pinned. editableWidgetTypes is a hand-maintained bridge between MDL type names and Mendix's, so TestEditableWidgetTypesMatchMetamodel parses generated/metamodel and fails if that set of 11 ever changes — in either direction.

Also: the residue of fixing Bug 1

contentparams supplied where no property text carries a {N} placeholder still had nothing to attach to and was dropped without a word. MDL-WIDGET21 reports it.

Neither rule is a .fail.mdl

Both are warnings, so check exits 0 and such a fixture would report negative test unexpectedly passed — the trap the Makefile documents above check-mdl, and the one that broke mendixlabs#927's CI. They are demonstrated by a plain .mdl and pinned by unit tests, which is what that note prescribes.

Verification

  • Reported script: 0 errors under mx check on 11.13 (was CE0720), with the stored parameter compared against the dynamictext control rather than just counted.
  • Controls: removing the engine wiring reproduces CE0720; unhooking the rule drops all three MDL-WIDGET20 cases while the direct/input cases keep passing.
  • Input widgets (textbox, textarea, checkbox, datepicker) stay clean — 8 shipped examples use editable: and none is flagged.
  • 339 shipped examples scanned: the only MDL-WIDGET20/21 hit is the fixture that exists to demonstrate them.
  • make check-mdl exits 0; 76 unit packages green; gofmt -l clean.

Not addressed

The def-mapped texttemplate path (BuildContext) has no parameter field, so a widget whose text template arrives through a .def.json mapping rather than as an explicit property is untouched. The reported case does not go through it, and plumbing it is a larger change — flagging it rather than leaving it to be discovered.


Generated by Claude Code

claude and others added 2 commits August 19, 2026 11:52
… editable (mendixlabs#928)

Two reported bindings that passed `mxcli check`, were written by `exec`, and
did nothing. They share one cause: the allow-lists behind MDL-WIDGET01 and
MDL-WIDGET07 are widget-type AGNOSTIC. isBuiltinPropName is a single flat
list holding both ContentParams and Editable; it answers "is this a real MDL
property name anywhere", and both validators read it as "is this valid on
THIS widget". The engine then acts on each only for the widget kinds that
support it, so the rest is dropped in silence.

Bug 1 -- FIXED. A pluggable widget's text-template property

    imageUrl: '{1}', contentparams: [{1} = PictureUrl]

stored a template with an EMPTY parameter list, and mxbuild answered CE0720
"Place holder index 1 is greater than 0, the number of parameter(s)" on the
FIRST write -- no describe round-trip needed, contrary to the report. A
dynamictext with identical syntax stored the parameter correctly, which is
the control that localised it to the pluggable path.

The engine took the parameters path only for mxcli's `{AttrName}` spelling,
so Mendix's own numeric `{1}` had no route. Both spellings now reach the same
stored shape via SetTextTemplateWithClientParams, added to the builder
interface and to both implementations. Verified: the reported script is 0
errors and the Image's template holds one parameter bound to
Product.PictureUrl, byte-comparable with the dynamictext control.

Bug 2 -- NOT FIXABLE AS ASKED, so reported instead (MDL-WIDGET20). Mendix
models editability on INPUT widgets only: measured against
generated/metamodel, exactly eleven Pages types carry Editability /
ConditionalEditabilitySettings -- ten inputs plus DataView -- and not one of
the fourteen button types does. There is no field to write, so
`editable:` -> Editability on a button cannot be implemented; the issue's own
second option is the right one. The warning names conditional visibility,
which buttons do support.

Both MDL spellings are caught. `editable: 'x'` lowers to `Editable`, the
bracket form `editable: [expr]` to `EditableIf` -- and the bracket form is the
one that genuinely works on inputs, so leaving it unflagged on a button would
have been the more surprising silent drop. The type list is a hand-maintained
bridge between MDL and Mendix names, so a test parses the metamodel and fails
if that set of eleven changes.

Also MDL-WIDGET21, the residue of fixing bug 1: contentparams with no `{N}`
placeholder to consume them still had nothing to attach to and were dropped
without a word.

Neither rule is a .fail.mdl. Both are warnings, so `check` exits 0 and such a
fixture would report "negative test unexpectedly passed" -- the trap the
Makefile documents above check-mdl, and the one that broke mendixlabs#927's CI. They
are demonstrated by a plain .mdl and pinned by unit tests.

Verified: reported script 0 errors under mx check (was CE0720); controls with
each fix removed reproduce CE0720 and drop all three MDL-WIDGET20 cases;
input widgets and 339 shipped examples produce no new warning; `make
check-mdl` exits 0; 76 unit packages green; gofmt clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013uQvFDd5R4eNqqita59jM8
@ako
ako merged commit 626b254 into main Aug 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants