Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting default values #153

Open
vegetablesalad opened this issue Feb 5, 2025 · 1 comment
Open

Setting default values #153

vegetablesalad opened this issue Feb 5, 2025 · 1 comment

Comments

@vegetablesalad
Copy link

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
                    }
                },
@adityacodepublic
Copy link
Contributor

        <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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants