DRG Forms reference

DRG Form is text document written in YAML format. YAML is human friendly easy to read and update format. In YAML options can be nested simply by offsetting lines by blank space characters.

 

Simplest DRG form is shown below.

 

## Form for dc_manual settings
table: dc_memory
title: helpers.dc_manual.settings
  eval: Class.method_name
control: design_element_settings

form:
  actions:
    1: save

  fields:
    10:
      name: manual_id
      type: select
      text: helpers.dc_manual.drg_manual_id
      help: helpers.dc_manual.drg_manual_id_help
      eval: "dc_choices4('dc_manual','title')"

 

table: is required and defines table (collection) where entered data will be saved. Table option is written in snake_case. Collection name must be defined as a Mongoid class model (written in CamelCase). In our example DcMemory model defines special model which holds data in the memory.

 

title: Title of data input form. Title can also have a nested keyword eval: which would provide title dynamically.

 

control: Controls file which will be used for processing the form. Methods defined in controls file are included into cmsedit controller during action processing and become part of cmsedit controller for the time of action. By default controls file name is constructed from table name and string "_control".  For example dc_site collection will have dc_site_control file which implements DcSiteControl class. Non default controls are defined by option control.

 


Last update: 29.01.2022