Link Search Menu Expand Document

Liform props

The props generated by Pitch Liform and consumed by the Liform component look roughly like this:

{
    // The root name under which the server should receive the data.
    // E.g. topic will be send as myArticleForm[topic] so that no further steps
    // on the Symfony receiving end are necessary for mapping.
    name: 'myArticleForm',

    // The JSON Schema describing the form elements.
    schema: {
        title: 'My super interesting new article form',
        properties: {
            topic: {
                type: 'string',
                title: 'Topic',
                placeholder: 'Enter some clickbait!',
            },
            description: {
                type: 'string',
                title: 'Content',
                widget: 'textarea',
            },
        },
        required:['topic'],
    },

    // The initial/pristine value for the form.
    value: {
        description: 'You would not believe what I just discovered...\n\n',
    },

    // Meta data for the initial value.
    meta: {
        errors: {
            topic: [
                'You need to enter a topic for the article.',
            ],
        },
    }
}

The props for built-in Symfony Form Types can be found here.