Autoform Nav Elements

A complete reference of all Autoform nav elements

autoform_navs contains the content of each Autoform link. It has a nested structure and Autoform uses recursive algorithms to access/set its content.

The sync function infers as much as possible from the models to avoid redundant configurations.

Base Structure

The base structure is as in the following example, which has 2 navs (meaning two menu items on top of the page), with labels "Nav Label A" and "Nav Label B" respectively. Each nav has 1 child, with category "handsontable" that will display a table in Autoform.

"autoform_navs": [
    {
        "label_map": {
            "en": "Nav Label A",
        },
        "children": [
            {
                "label_map": {
                    "en": "Table A",
                },
                "attributes": {
                    "required": True,
                },
                "item_name": "nav_label_a",
                "category": "handsontable",
                "table_settings": {
                    "options": {},
                },
                "table_columns": table_columns_a,
                "table_data": table_data_a,
            },
        ],
    },
    {
        "label_map": {
            "en": "Nav Label B",
        },
        "children": [
            {
                "label_map": {
                    "en": "Nav Label B",
                },
                "attributes": {
                    "required": False,
                },
                "item_name": "nav_label_b",
                "category": "handsontable",
                "table_settings": {
                    "options": {},
                },
                "table_columns": table_columns_b,
                "table_data": table_data_b,
            },
        ],
    },
]

Child Elements

The below section shows code snippets illustrating how to use the different child elements.

"category": "input"

type="text"

type="textarea"

type="number"

type="email"

type="date"

type="radio"

Radio buttons are displayed automatically if the corresponding model field choices are less than 5.

{
    "model": custom_models.EcoPackMonitorPrimaryPackaging,
    "item_name": "has_hanger",
    # "category": "input", # inferred from the model field
    # "type": "radio", # inferred from the model field
    "label_map": {
        "en": "Packaging that is part of the product<br><strong>Is there a referenced hanger?</strong>"
    },
    "attributes": {
        "required": True, # inferred from the model field (False if the field is nullable, else True) - it is overwritten here
    },    
    "children": [],
},

Corresponding model field name:

class EcoPackMonitorPrimaryPackaging(ModelMixin):
    has_hanger = models.BooleanField(choices=TRUE_FALSE_CHOICES, blank=True, null=True, verbose_name="Is there a hanger?")

type="rangeslider"

type="checkbox"

"category": "handsontable"

"category": "upload"

"category": "group"

"category": "card"

Nested Children

Each child can have 0 to many children, which will be displayed as nested elements.

Last updated