auto-form icon indicating copy to clipboard operation
auto-form copied to clipboard

Setting default values

Open vegetablesalad opened this issue 11 months ago • 1 comments

Not sure if I'm not setting them correctly but defaults don't really work for me: It will set the value correctly, but when submitting it will throw out an error that field is empty. Unless I interact with it manually.

        <AutoForm
            formSchema={formSchema}
            onSubmit={(d)=>onSubmit(d)}

            fieldConfig={{
                name: {
                    label:"Vārds",
                    inputProps: {
                        defaultValue:child?.name
                    }
                },

vegetablesalad avatar Feb 05 '25 21:02 vegetablesalad

        <AutoForm
          schema={schemaProvider}
          onSubmit={(d)=>onSubmit(d}
          defaultValues={{
            name: "John Doe",
            age: 25,
            email: "[email protected]",
            website: "https://example.com",
            color: "green",
            birthdate: "1990-01-01" as unknown as Date,
            isStudent: true,
          }}
          withSubmit
        />

try this

adityacodepublic avatar Feb 11 '25 09:02 adityacodepublic