auto-form
auto-form copied to clipboard
Setting default values
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
}
},
<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