Skip to content

Commit 567bf4e

Browse files
committed
feat(pages): Confirmation on call-microflow / call-nanoflow actions
Studio Pro's "Ask confirmation" (Forms$ConfirmationInfo) had no MDL: the key was MDL-WIDGET07 and ConfirmationInfo was always null. Add Confirmation / ConfirmationProceed / ConfirmationCancel on action buttons and clickable containers, written in Studio Pro's shape (pinned against ConversationalUI.Snippet_Agent_Details) and described back. Mendix has no confirmation on Delete/Save/Close actions, so the key is refused there (MDL-WIDGET35 at check, a builder error at exec) with the remedy. Field run: ProcureFlow (Mendix 11.14.0) scratch copy — a Delete button and a clickable container calling a delete microflow with confirmation: stored ConfirmationInfo, describe round-trips, mx check 0 errors; control (Confirmation on delete_object) refused by check and exec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5dJ4raEjbm8bFiKeYtchS
1 parent 9509176 commit 567bf4e

20 files changed

Lines changed: 511 additions & 3 deletions

‎.claude/skills/mendix/create-page/SKILL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Both are optional and can be changed later with `alter page … { set Class = '
7171
| Widget validation | `Validation: '<expr>'` + `ValidationMessage: '<text>'` | `Validation: 'length(toString($value)) > 0'` — quoted, not `[bracketed]` |
7272
| Variable binding | `datasource: $Var` | `dataview dv (datasource: $Product) { ... }` |
7373
| Action binding | `action: type` | `actionbutton btn (caption: 'Save', action: save_changes)` |
74+
| Ask confirmation | `confirmation: 'question'` (+ optional `confirmationproceed:` / `confirmationcancel:`) | `actionbutton btn (caption: 'Delete', action: microflow M.ACT_Delete(Item: $Item), confirmation: 'Delete this item?')` — microflow / nanoflow actions only (MDL-WIDGET35 elsewhere) |
7475
| Database source | `datasource: database entity` | `datagrid dg (datasource: database Module.Entity)` |
7576
| Selection binding | `datasource: selection widget` | `dataview dv (datasource: selection galleryList)` |
7677
| CSS class | `class: 'classes'` | `container c (class: 'card mx-spacing-top-large')` |

‎.claude/skills/mendix/create-page/reference/widgets.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ describe icon collection Atlas_Core.Atlas_Filled -- every icon + its reference
162162
`action: nothing` when a control really is meant to be inert, so a dead one
163163
always means a mistake.
164164
- The same forms serve `onclick:` (an alias of `action:`) and `onchange:`.
165+
- **Ask confirmation first** (Studio Pro's "Ask confirmation"): add
166+
`confirmation: 'question'` to a widget whose action is `microflow …` or
167+
`nanoflow …` — a button, a link button or a clickable container. Optional
168+
`confirmationproceed:` / `confirmationcancel:` set the two button captions
169+
(default `Proceed` / `Cancel`). Mendix has **no** confirmation on `delete`,
170+
`save_changes`, `close_page`, `show_page` or any other action, so there it is
171+
**MDL-WIDGET35** rather than dropped: to confirm a delete, call a microflow
172+
that deletes and put the confirmation on that call.
165173

166174
**Button Styles:** `default`, `primary`, `success`, `info`, `warning`, `danger`, `inverse`
167175
- Case-insensitive (`primary` and `Primary` both work).
@@ -184,6 +192,10 @@ actionbutton btnProcess (caption: 'Process', action: microflow Module.ACT_Proces
184192
-- Call microflow with $currentObject (inside DATAGRID/LISTVIEW column)
185193
actionbutton btnDelete (caption: 'Delete', action: microflow Module.ACT_Delete(Target: $currentObject), buttonstyle: danger)
186194

195+
-- Ask for confirmation before the microflow runs (microflow / nanoflow actions only)
196+
actionbutton btnDelete (caption: 'Delete', action: microflow Module.ACT_Delete(Target: $currentObject), buttonstyle: danger,
197+
confirmation: 'Delete this item?', confirmationproceed: 'Delete')
198+
187199
-- Create object and show page
188200
actionbutton btnNew (caption: 'New', action: create_object Module.Product then show_page Module.Product_Edit, buttonstyle: primary)
189201
```

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- **`Confirmation: '…'` on a call-microflow / call-nanoflow action — Studio Pro's "Ask confirmation"** (with optional `ConfirmationProceed:` / `ConfirmationCancel:`, defaulting to Studio Pro's `Proceed` / `Cancel`) on an action button or a clickable container. There was no MDL for it: `Confirmation:` was MDL-WIDGET07 "silently dropped" and the writer always stored `ConfirmationInfo` null, so a Delete button could not ask first. It is stored as the `Forms$ConfirmationInfo` Studio Pro writes (ConversationalUI.Snippet_Agent_Details) and `describe` prints it back. Mendix has no confirmation on Delete, Save or Close actions, so `Confirmation:` there is refused (**MDL-WIDGET35**) with the remedy — call a microflow that deletes — instead of being dropped.
12+
913
### Changed
1014

1115
- **`DynamicClasses` and a column's `DynamicCellClass` are written as Mendix expressions** (mendixlabs/mxcli#750) — the expression is written as-is, so the doubled-quote spelling is gone: `dynamicclasses: if $currentObject/Featured then 'is-featured' else ''`, and `dynamicclasses: 'is-featured'` is the string — the class `is-featured`. The same rule as the OData client's credentials. `create page`, `alter page … set` and `describe` all use it, and a describe → exec round trip stores identical values (measured on a Mendix 11.14.0 project). **Migrating a script:** the old spelling, the expression's text in quotes (`'if … then ''a'' else '''''`), still parses but would now store that text as a class name, so `check` and `exec` refuse it as **MDL-WIDGET33** and give the unquoted expression. An expression in any other widget property is an error rather than an empty value; a pluggable property whose schema kind is Expression (a column's `Visible`, for one) keeps the quoted form until a following change.

‎cmd/mxcli/syntax/features_page.go‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ CREATE PAGE Sales.Detail (Title: 'Detail', Layout: Atlas_Core.Atlas_Default) {
144144
"-- container the grid declares — it used to be dropped on write with no\n" +
145145
"-- diagnostic, and is now refused (MDL-WIDGET30).\n\n" +
146146
"-- Inputs\nTEXTBOX name (Label: 'L', Attribute: Attr)\nTEXTAREA | DATEPICKER | COMBOBOX | CHECKBOX | RADIOBUTTONS\n\n" +
147-
"-- Actions\nACTIONBUTTON name (Caption: 'C', Action: SAVE_CHANGES, ButtonStyle: Primary)\nLINKBUTTON name (Caption: 'C', Action: ...)\n\n" +
147+
"-- Actions\nACTIONBUTTON name (Caption: 'C', Action: SAVE_CHANGES, ButtonStyle: Primary)\nLINKBUTTON name (Caption: 'C', Action: ...)\n" +
148+
"-- Studio Pro's \"Ask confirmation\" — call-microflow / call-nanoflow actions only\n" +
149+
"-- (Mendix stores none on Delete/Save/Close; call a microflow that deletes).\n" +
150+
"-- ConfirmationProceed / ConfirmationCancel default to 'Proceed' / 'Cancel':\n" +
151+
"ACTIONBUTTON btnDelete (Caption: 'Delete', Action: MICROFLOW M.ACT_Delete(Item: $currentObject),\n" +
152+
" Confirmation: 'Delete this item?', ConfirmationProceed: 'Delete')\n\n" +
148153
"-- Display\nDYNAMICTEXT name (Content: 'Hello, {1}!', ContentParams: [{1} = Name])\nTITLE name (Content: 'Heading')\nIMAGE name (Image: 'Module.Collection.ImageName')\nIMAGE name (ImageType: imageUrl, ImageUrl: 'https://…')\n" +
149154
"-- IMAGE needs a source. Its default, `ImageType: image`, shows an entry from an\n" +
150155
"-- image collection, named as three parts: Module.Collection.ImageName.\n" +

‎docs-site/src/appendixes/quick-reference.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ MDL uses explicit property declarations for pages:
355355
| Variable binding | `DataSource: $Var` | `DATAVIEW dv (DataSource: $Product) { ... }` |
356356
| Action binding | `Action: TYPE` | `ACTIONBUTTON btn (Caption: 'Save', Action: SAVE_CHANGES)` |
357357
| Microflow action | `Action: MICROFLOW Name(Param: val)` | `Action: MICROFLOW Mod.ACT_Process(Order: $Order)` |
358+
| Ask confirmation | `Confirmation: 'question'` (+ `ConfirmationProceed:`, `ConfirmationCancel:`) | `ACTIONBUTTON btn (Caption: 'Delete', Action: MICROFLOW Mod.ACT_Delete(Order: $Order), Confirmation: 'Delete this order?')` — microflow / nanoflow actions only (MDL-WIDGET35 elsewhere) |
358359
| Database source | `DataSource: DATABASE Entity` | `DATAGRID dg (DataSource: DATABASE Module.Entity)` |
359360
| Selection binding | `DataSource: SELECTION widget` | `DATAVIEW dv (DataSource: SELECTION galleryList)` |
360361
| CSS class | `Class: 'classes'` | `CONTAINER c (Class: 'card mx-spacing-top-large')` |

‎docs-site/src/language/widget-types.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,27 @@ ACTIONBUTTON btnProcess (
369369
)
370370
```
371371

372+
**Asking for confirmation** — Studio Pro's "Ask confirmation". A microflow or
373+
nanoflow action can show a question before it runs. `ConfirmationProceed` and
374+
`ConfirmationCancel` set the two button captions and default to `Proceed` and
375+
`Cancel`:
376+
377+
```sql
378+
ACTIONBUTTON btnDelete (
379+
Caption: 'Delete',
380+
Action: MICROFLOW Sales.ACT_DeleteOrder(Order: $Order),
381+
ButtonStyle: Danger,
382+
Confirmation: 'Delete this order?',
383+
ConfirmationProceed: 'Delete'
384+
)
385+
```
386+
387+
The same properties work on a `LINKBUTTON` and on a clickable `CONTAINER`.
388+
Mendix stores a confirmation on the call-microflow and call-nanoflow actions
389+
only, so `Confirmation:` on `DELETE`, `SAVE_CHANGES`, `CLOSE_PAGE` or any other
390+
action is an error (**MDL-WIDGET35**). To confirm a delete, call a microflow that
391+
deletes and put the confirmation on that call.
392+
372393
**Icon** — `Icon: 'Module.IconCollection.IconName'` gives the button an icon from
373394
an icon collection (the modern Atlas icon set). The name must exist in the
374395
collection, or MxBuild rejects it (CE1613):

‎docs-site/src/reference/page/create-page.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ DATAGRID dgOrders (DataSource: DATABASE FROM Sales.Order, Selection: Single) {
159159

160160
`mxcli check -p <app.mpr>` reports a missing argument before mxbuild does.
161161

162+
A microflow or nanoflow action can **ask for confirmation** first (Studio Pro's
163+
"Ask confirmation"): `Confirmation: 'question'`, with optional
164+
`ConfirmationProceed:` and `ConfirmationCancel:` captions that default to
165+
`Proceed` and `Cancel`. It works on buttons and clickable containers alike.
166+
Mendix has no confirmation on the other actions, so there it is refused
167+
(**MDL-WIDGET35**). Call a microflow that performs the action instead:
168+
169+
```sql
170+
ACTIONBUTTON btnDelete (Caption: 'Delete',
171+
Action: MICROFLOW Sales.ACT_DeleteOrder(Order: $Order),
172+
Confirmation: 'Delete this order?', ConfirmationProceed: 'Delete')
173+
```
174+
162175
### ButtonStyle Values
163176

164177
`Primary`, `Default`, `Success`, `Danger`, `Warning`, `Info`.

‎docs/01-project/MDL_QUICK_REFERENCE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ MDL uses explicit property declarations for pages:
14481448
| Glyph icon | `icon: glyph <code>` | `actionbutton btn (caption: 'Home', action: nothing, icon: glyph 57377)` — a font code point with no name. Codes are sparse; an undefined one fails only at `mxbuild --target=deploy`, naming the **page**, so **MDL078** checks it. Browse with `show glyphs` |
14491449
| Clickable container | `onclick: action` (alias of `action:`) | `container card (onclick: microflow Mod.ACT_Open) { ... }` — takes an argument list like a button: `action: nanoflow Mod.ACT_Ship($Order = $dgOrders)` |
14501450
| Action arguments | every parameter needs one | A flow action with an unfilled parameter is **CE1571**. An enclosing data container of its type supplies it; a data grid's **control bar** does not (not row-scoped) — pass the grid's selection, `$dgOrders` |
1451+
| Ask confirmation | `confirmation: 'question'` [, `confirmationproceed: 'caption'`, `confirmationcancel: 'caption'`] | `actionbutton btn (caption: 'Delete', action: microflow Mod.ACT_Delete(Order: $Order), confirmation: 'Delete this order?', confirmationproceed: 'Delete')` — Studio Pro's "Ask confirmation", on a button or clickable container whose action calls a **microflow or nanoflow**; the captions default to `Proceed` / `Cancel`. Mendix stores no confirmation on Delete / Save / Close / Show page actions, so it is refused there (**MDL-WIDGET35**) — call a microflow that deletes, and confirm that |
14511452
| Database source | `datasource: database entity` | `datagrid dg (datasource: database Module.Entity)` |
14521453
| Database source, constrained and sorted | `datasource: database entity where [...] sort by Attr asc` | `listview lv (datasource: database from Mod.Vehicle where [Brand != ''] sort by Brand asc)` |
14531454
| List view search bar | `... search by Attr, Attr2` | `listview lv (datasource: database from Mod.Vehicle search by Brand, Model)` — **list view only**; mirrors `sort by` and takes no direction |
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
-- ============================================================================
2+
-- Action confirmation — Studio Pro's "Ask confirmation"
3+
-- ============================================================================
4+
--
5+
-- A call-microflow or call-nanoflow action can ask the user before it runs:
6+
-- Studio Pro's "Ask confirmation" checkbox, stored as Forms$ConfirmationInfo
7+
-- (question, proceed caption, cancel caption).
8+
--
9+
-- Confirmation: 'question' -- turns it on; the question text
10+
-- ConfirmationProceed: 'caption' -- optional, defaults to 'Proceed'
11+
-- ConfirmationCancel: 'caption' -- optional, defaults to 'Cancel'
12+
--
13+
-- Works on an action button, a link button, and a clickable container — any
14+
-- widget whose Action: / OnClick: calls a microflow or a nanoflow. `describe`
15+
-- prints the properties back, leaving out captions equal to the defaults.
16+
--
17+
-- Mendix stores NO confirmation on the other client actions (Delete, Save,
18+
-- Close page, Show page, …), so `Confirmation:` there is refused — by `check`
19+
-- as MDL-WIDGET35 and by `exec` — instead of being dropped. To confirm a delete,
20+
-- call a microflow that deletes, as the pages below do.
21+
--
22+
-- ============================================================================
23+
24+
create module ConfirmTest;
25+
26+
create persistent entity ConfirmTest.Item (
27+
Name: string(200) not null,
28+
IsArchived: boolean default false
29+
);
30+
31+
/**
32+
* Deletes one item. Called from the pages below with a confirmation, which is
33+
* how a delete asks first: the Delete client action itself cannot.
34+
*
35+
* @param $Item The item to delete
36+
*/
37+
create microflow ConfirmTest.ACT_Item_Delete (
38+
$Item: ConfirmTest.Item
39+
)
40+
begin
41+
delete $Item;
42+
end;
43+
/
44+
45+
/**
46+
* Archives one item, client-side.
47+
*
48+
* @param $Item The item to archive
49+
*/
50+
create nanoflow ConfirmTest.ACT_Item_Archive (
51+
$Item: ConfirmTest.Item
52+
)
53+
begin
54+
change $Item (IsArchived = true) refresh;
55+
end;
56+
/
57+
58+
-- MARK: Buttons
59+
60+
/**
61+
* Action buttons and a link button with a confirmation.
62+
*
63+
* - btnDelete: question plus a custom proceed caption; cancel keeps Studio
64+
* Pro's default 'Cancel'.
65+
* - btnArchive: a nanoflow action; both captions custom.
66+
* - lnkDelete: the same on a link button, captions left at their defaults.
67+
*
68+
* @param $Item The item shown on the page
69+
*/
70+
create page ConfirmTest.Item_Detail
71+
(
72+
params: { $Item: ConfirmTest.Item },
73+
title: 'Item',
74+
layout: Atlas_Core.PopupLayout
75+
)
76+
{
77+
layoutgrid lgItem {
78+
row row1 {
79+
column col1 (desktopwidth: autofill) {
80+
dataview dvItem (datasource: $Item) {
81+
textbox txtName (label: 'Name', attribute: Name)
82+
footer footer1 {
83+
actionbutton btnDelete (
84+
caption: 'Delete',
85+
action: microflow ConfirmTest.ACT_Item_Delete(Item: $Item),
86+
buttonstyle: danger,
87+
confirmation: 'Delete this item? This cannot be undone.',
88+
confirmationproceed: 'Delete'
89+
)
90+
actionbutton btnArchive (
91+
caption: 'Archive',
92+
action: nanoflow ConfirmTest.ACT_Item_Archive(Item: $Item),
93+
confirmation: 'Archive this item?',
94+
confirmationproceed: 'Archive',
95+
confirmationcancel: 'Keep'
96+
)
97+
linkbutton lnkDelete (
98+
caption: 'Delete (link)',
99+
action: microflow ConfirmTest.ACT_Item_Delete(Item: $Item),
100+
confirmation: 'Delete this item?'
101+
)
102+
actionbutton btnClose (caption: 'Close', action: close_page)
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}
109+
110+
-- MARK: Clickable container
111+
112+
/**
113+
* A clickable container asks the same way: the confirmation goes on the
114+
* container that carries the action.
115+
*/
116+
create page ConfirmTest.Item_Overview
117+
(
118+
title: 'Items',
119+
layout: Atlas_Core.Atlas_Default
120+
)
121+
{
122+
listview lvItems (datasource: database ConfirmTest.Item) {
123+
container cntItem (
124+
class: 'card clickable',
125+
action: microflow ConfirmTest.ACT_Item_Delete(Item: $currentObject),
126+
confirmation: 'Delete this item?',
127+
confirmationproceed: 'Delete'
128+
) {
129+
dynamictext txtItemName (content: '{1}', contentparams: [{1} = Name])
130+
}
131+
}
132+
}
133+
134+
-- MARK: Describe
135+
136+
-- Prints the Confirmation / ConfirmationProceed / ConfirmationCancel lines back.
137+
describe page ConfirmTest.Item_Detail;
138+
describe page ConfirmTest.Item_Overview;
139+
140+
-- Refused — Mendix has no confirmation on a Delete client action (MDL-WIDGET35):
141+
--
142+
-- actionbutton btnDeleteDirect (caption: 'Delete', action: delete,
143+
-- confirmation: 'Delete this item?')
144+
--
145+
-- Call a microflow that deletes instead, as btnDelete above does.

‎mdl/backend/modelsdk/widget_write.go‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,13 @@ func clientActionToGen(a pages.ClientAction) (element.Element, error) {
18721872
}
18731873
assignID(g)
18741874
g.SetDisabledDuringExecution(true)
1875-
g.SetMicroflowSettings(microflowSettingsToGen(x.MicroflowName, x.ParameterMappings))
1875+
settings := microflowSettingsToGen(x.MicroflowName, x.ParameterMappings)
1876+
if x.Confirmation != nil {
1877+
if s, ok := settings.(*genPg.MicroflowSettings); ok {
1878+
s.SetConfirmationInfo(confirmationInfoToGen(x.Confirmation))
1879+
}
1880+
}
1881+
g.SetMicroflowSettings(settings)
18761882
return g, nil
18771883
case *pages.NanoflowClientAction:
18781884
// call_nanoflow → Forms$CallNanoflowClientAction. Unlike the microflow
@@ -1887,6 +1893,9 @@ func clientActionToGen(a pages.ClientAction) (element.Element, error) {
18871893
g.SetDisabledDuringExecution(true)
18881894
g.SetNanoflowQualifiedName(x.NanoflowName)
18891895
g.SetProgressBar("None")
1896+
if x.Confirmation != nil {
1897+
g.SetConfirmationInfo(confirmationInfoToGen(x.Confirmation))
1898+
}
18901899
for _, pm := range x.ParameterMappings {
18911900
m := genPg.NewNanoflowParameterMapping()
18921901
assignID(m)
@@ -1975,3 +1984,16 @@ func menuSourceToGen(widget, menu, profile string) (element.Element, error) {
19751984
src.SetNavigationProfileQualifiedName(orDefaultStr(profile, "Responsive"))
19761985
return src, nil
19771986
}
1987+
1988+
// confirmationInfoToGen builds a Forms$ConfirmationInfo — Studio Pro's "Ask
1989+
// confirmation" on a call-microflow / call-nanoflow action. Pinned against
1990+
// ConversationalUI.Snippet_Agent_Details (11.14.0): three Texts$Text parts,
1991+
// Question, ProceedButtonCaption and CancelButtonCaption.
1992+
func confirmationInfoToGen(c *pages.ConfirmationInfo) element.Element {
1993+
ci := genPg.NewConfirmationInfo()
1994+
assignID(ci)
1995+
ci.SetQuestion(captionToGen(textFromString(c.Question)))
1996+
ci.SetProceedButtonCaption(captionToGen(textFromString(c.ProceedCaption)))
1997+
ci.SetCancelButtonCaption(captionToGen(textFromString(c.CancelCaption)))
1998+
return ci
1999+
}

0 commit comments

Comments
 (0)