SuperAPI AI Directory

form-edit

General & other

View repository

Updated 10-15 21:03

About this skill

/form-edit — Form editing

Makes targeted changes to an existing Form.xml according to the description of edits in JSON; it does not touch anything else in the file. A moved or modified element retains its id — handlers and references from the module continue to work.

Command

Parameter Required Description
FormPath yes Path to the existing Form.xml
JsonPath yes Path to the JSON with the description of edits
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/form-edit.ps1" -FormPath "<путь>" -JsonPath "<путь>"

What can be edited

Key Edit
elements Elements: add, move, modify, delete — list of operations, in order
attributes Attributes: add; { "remove": "Имя" } — delete
commands Commands: add; { "remove": "Имя" } — delete
parameters Form parameters: add; { "remove": "Имя" } — delete
title Form title (string or {ru, en}); null — remove
properties Form properties: { "windowOpeningMode": "LockOwnerWindow" }; null for a property — remove (references/form-properties.md)
events Form event handlers: { "OnOpen": "ПриОткрытии" }
excludedCommands Exclude standard commands: ["Copy"]; restore: { "remove": ["Copy"] }
conditionalAppearance Add conditional appearance rules (references/appearance.md)
commandInterface Add commands to form panels (references/command-interface.md)

All keys are optional; any of them can be combined in a single edit. Names of elements, attributes, and commands are from /form-info. Handler procedures are not created in the form module — they are added to Module.bsl separately.

Elements

The operation is specified by the key:

Key Operation
element type: input, group, table, … Add a new element
move Move: name or list of names (they are placed consecutively in this order) together with their contents
set Modify properties: name or list of names
remove Delete: name or list of names; group, page, table — together with their contents

Where the added or moved element is placed:

Keys Where
after: "X" / before: "X" Next to X, in its group
into: "G" At the end of G — group, page, table, command bar
into: "G", first: true At the beginning of G

A new element without a position goes at the end of the form; the next one without a position goes after it. For move position is required.

{
  "attributes": [ { "name": "Срочно", "type": "boolean" } ],
  "elements": [
    { "group": "alwaysHorizontal", "name": "ГруппаОтгрузка", "after": "Контрагент" },
    { "move": ["Склад", "Организация"], "into": "ГруппаОтгрузка" },
    { "check": "Срочно", "path": "Срочно", "into": "ГруппаОтгрузка" },
    { "move": "ТоварыСумма", "before": "ТоварыЦена" },
    { "set": "Ответственный", "visible": false },
    { "set": "Контрагент", "title": "Покупатель", "events": { "OnChange": null } },
    { "remove": "Комментарий" }
  ]
}

Change (set)

  • Keys are element properties, the same as when adding: title, visibility, availability, dimensions, colors and font, field buttons, choice parameters, etc. (table below and reference guides).
  • null returns the property to its default value.
  • String in title changes the Russian text, translations into other languages remain.
  • For a group, orientation is changed by group: { "set": "ГруппаШапка", "group": "vertical" }.
  • events adds handlers — like for a new element.
  • Name, element type, data path and button command set does not change: such an element is deleted and added anew.

Deletion together with the attribute

The field and the attribute to which it is bound are deleted in one edit:

{
  "elements":   [ { "remove": "Срочно" } ],
  "attributes": [ { "remove": "Срочно" } ]
}

New element

Key — element type, value — name; for group the value is orientation, and the name is set in name.

Key Element Details
input Input field input-fields.md
check / radio Checkbox / radio button input-fields.md
labelField Label field (value without editing) input-fields.md
label Label, text — in title tooltips-text.md
group Group: vertical / horizontalIfPossible / alwaysHorizontal groups-pages.md
pages / page Pages / page groups-pages.md
table / columnGroup Table / column group table-advanced.md
button / popup / buttonGroup / cmdBar Button / submenu / button group / command bar buttons-commands.md
picture / picField Picture / picture field pictures.md

Spreadsheet document, HTML, calendar, charts and other special fields — by index below.

Key Description
name Name, if different from the type key value. Names in the form are unique
path Data path: "Объект.Склад", "ИмяРеквизита"; table column — "Объект.Товары.Сумма"
title / tooltip Title / tooltip (string or {ru, en})
visible: false / enabled: false / readOnly: true Hide / make unavailable / read-only
events Handlers: { "OnChange": "ИмяПроцедуры" }; null instead of the name — name by template <Элемент><Событие>
children / columns Nested items of a group or page / table columns

Field on a new form attribute — attribute and item in a single edit:

{
  "attributes": [ { "name": "СуммаИтого", "type": "decimal(15,2)" } ],
  "elements": [ { "input": "СуммаИтого", "path": "СуммаИтого", "readOnly": true, "after": "Контрагент" } ]
}

Column in an existing table — an item next to another column or into of the table:

{ "input": "ТоварыСкидка", "path": "Объект.Товары.Скидка", "after": "ТоварыЦена" }

Button — into the form command bar (ФормаКоманднаяПанель) or the table (ТоварыКоманднаяПанель); command — form command, stdCommand — standard ("Close", for the table — "Товары.Add"):

{
  "commands": [ { "name": "Пересчитать", "action": "ПересчитатьОбработка" } ],
  "elements": [ { "button": "Пересчитать", "command": "Пересчитать", "into": "ФормаКоманднаяПанель" } ]
}

Form command bar properties — operation autoCmdBar: { "autoCmdBar": "ФормаКоманднаяПанель", "autofill": false } (without standard commands), horizontalAlign.

Events

Names are case-sensitive.

Form: OnCreateAtServer, OnOpen, BeforeClose, OnClose, NotificationProcessing, ChoiceProcessing, OnReadAtServer, BeforeWriteAtServer, OnWriteAtServer, AfterWriteAtServer, BeforeWrite, AfterWrite, FillCheckProcessingAtServer, BeforeLoadDataFromSettingsAtServer, OnLoadDataFromSettingsAtServer, ExternalEvent, Opening

input: OnChange, StartChoice, ChoiceProcessing, AutoComplete, TextEditEnd, Clearing, Creating, EditTextChange check / radio: OnChange table: OnStartEdit, OnEditEnd, OnChange, Selection, ValueChoice, BeforeAddRow, BeforeDeleteRow, AfterDeleteRow, BeforeRowChange, BeforeEditEnd, OnActivateRow, OnActivateCell label / labelField: Click, URLProcessing; у labelField also OnChange, StartChoice, ChoiceProcessing, Clearing picture / button: Click pages: OnCurrentPageChange

Attributes, commands, parameters

"attributes": [ { "name": "Итого", "type": "decimal(15,2)", "title": "Итого" },
                { "name": "Данные", "type": "ValueTable", "columns": [ { "name": "Сумма", "type": "decimal(15,2)" } ] } ],
"commands":   [ { "name": "Загрузить", "action": "ЗагрузитьОбработка", "shortcut": "Ctrl+Enter" } ],
"parameters": [ { "name": "Основание", "type": "DocumentRef.Заказ", "key": true } ]

Types: string, string(100), decimal(15,2), boolean, date, dateTime, CatalogRef.X, DocumentRef.X, EnumRef.X, ValueTable, ValueList, DynamicList, Тип1 | Тип2 — all types in references/type-system-advanced.md. The remaining attribute keys — attributes-advanced.md, command keys — buttons-commands.md.

Extension form

Extension form (with <BaseForm>) is recognized automatically. Extension's own items, attributes and commands are named with the extension prefix (Расш1_Метка) and are given title — otherwise the title will be taken from the name together with the prefix. The handler is given the call type — callType: Before, After or Override; without it — Before:

{
  "events": { "OnCreateAtServer": { "handler": "Расш1_ПриСозданииПосле", "callType": "After" } },
  "elements": [
    { "set": "Банк", "events": { "OnChange": { "handler": "Расш1_БанкПриИзменении", "callType": "Before" } } }
  ],
  "commands": [
    { "name": "Подбор", "action": "Расш1_ПодборПосле", "callType": "After" },
    { "name": "Запрос", "actions": [
      { "handler": "Расш1_ЗапросПеред", "callType": "Before" },
      { "handler": "Расш1_ЗапросПосле", "callType": "After" } ] }
  ]
}

Task → catalog

For the task, load the file from references/:

Task Catalog
Input field, checkbox, radio button: buttons, choice list, quick choice, custom choice form, mask, format, password, switch/toggle, composite type field input-fields.md
Restrict choice by a filter, link a field to another field, link by type choice-params.md
Group and pages: orientation, frame, collapsed group, intervals, title from data, bookmark icon, step-by-step wizard groups-pages.md
Table: columns and column groups, totals in the footer, tree, row selection, column pinning, search, drag-and-drop table-advanced.md
List form: data source, query, filter, sorting, grouping, hierarchy dynamic-list.md
Buttons, submenus, commands: button picture, toggle in the bar, table commands in a button group, custom context menu for a field, command for the current row buttons-commands.md
Highlight with color, font, border, conditional formatting (in list form — dynamic-list.md) appearance.md
Extended tooltip under the field, label with highlighting or a link tooltips-text.md
Image, icon in a column, icon by value pictures.md
Spreadsheet document (print form, report on a form) spreadsheet.md
HTML, text document, indicator, slider, calendar, period special-fields.md
Chart, Gantt chart, scheduler charts.md
Form properties: modality, size, scrolling, Enter, document time and posting form-properties.md
Report form (DCS) report-form.md
Attributes: saving in settings, fill check, functional options attributes-advanced.md
Attribute types, composite types and sets type-system-advanced.md
Visibility and access by roles roles-access.md
Form command interface (navigation, important commands) command-interface.md
Sizes, alignment, default focus, narrow screens layout-advanced.md

Workflow

  1. /form-info — form structure: element names, attributes, commands.
  2. Describe the edits in JSON.
  3. /form-edit — apply; in the output — what was added, moved, changed, and deleted.
  4. /form-validate — check the form.