Question
I am creating a button in the context menu, which, when clicked, overwrites data in the adjacent cell using the set function. I need it to request confirmation of the operation, something like "Are you sure?" "Yes", "No". And when "Yes" is clicked, the action will be performed, otherwise close.
Answer
this can be done through an intermediate linkToButtons
Example:
p1=: panelButton(code: $question; text: "Set value"; vars: $vars; refresh: true)
vars: rowCreate(field: "set_code" = $set)
```question:totum
=: linkToButtons(title: "Are you sure?"; buttons: $buttons; refresh: true)
buttons: listCreate(item: $btn1)
btn1: rowCreate(field: "text" = "Yes, change"; field: "code" = $code; field: "refresh" = true)
code: $#set_code
```
```set:totum
=: set(table: 'table_name'; field: 'field_name' = $value; where: 'id' = #id; log: true)
value: true
```
In the nested code with set
, the table and file need to be specified explicitly because the nested code does not have information about the starting table from which it was called.