Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

[Documentation Request] Custom Fields and Validators #300

Open
@samo9789

Description

@samo9789

Hi,

We were able to use a custom field to have a Google Maps auto completed address field.
This field should be mandatory...

Currently, we have

In the form declaration :

address: CustomField({
                        label: 'Adresse',
                        placeholder: '85 rue ...',
                        validations: [
                            Validator({
                                validator: required,
                                text: 'Le champ adresse est obligatoire',
                            }),
                        ],
                    }),

and in the template

<dynamic-form :form="form" @submitted="sendAddress">
            <template v-slot:address="{ control, onChange, onFocus, onBlur }">
                <GMapAutocomplete v-if="control"
                    :placeholder="control.placeholder"
                    @place_changed="setPlace"
                    @change="onChange"
                    @focus="onFocus"
                    @blur="onBlur"
                />
            </template>
        </dynamic-form>

Leaving the field empty does not raise an error while leaving this field empty does show the specified message

name: TextField({
                        label: 'Nom de votre adresse',
                        placeholder: 'Exemple: Maison Paris, Maison de la plage, ...',
                        validations: [
                            Validator({
                                validator: required,
                                text: 'Cette information est  obligatoire',
                            }),
                        ],
                    }),

Could you please add to the documentation how to make use of the validators for custom fields ?

Thank you very much

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions