Lenra Docs
Register on Lenra
  • Home
  • Getting started
    Open/Close
  • Guides
    Open/Close
  • Features
    Open/Close
  • References
    Open/Close
  • Contribute

    Form

    The Form component is a container that dispatches an event with all its containing field values.

    Examples

    Simple form

    Here is a basic Form component example:

    {
        "type": "form",
        "onSubmit": {
            "_type": "listener",
            "name": "myListener",
        },
        "child": {
            "type": "flex",
            "children": [
                {
                    "type": "textfield",
                    "value": "",
                    "name": "myField"
                },
                {
                    "type": "textfield",
                    "value": "",
                    "name": "secondField"
                },
                {
                    "type": "button",
                    "text": "Send",
                    "submit": true
                }
            ]
        }
    }
    

    The myListener listener will be triggered with an event containing the next data:

    {
        "myField": "The first field value",
        "secondField": "The second field value"
    }
    

    Properties

    AttributeDescriptionType
    _typeThe type of the element
    • form
    childAny componentComponent
    onSubmitCallback when the user submits the form.Listener